chromium/v8/src/date/date.h

// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_DATE_DATE_H_
#define V8_DATE_DATE_H_

#include <cmath>

#include "src/base/small-vector.h"
#include "src/base/timezone-cache.h"
#include "src/common/globals.h"
#include "src/objects/smi.h"

namespace v8 {
namespace internal {

class V8_EXPORT_PRIVATE DateCache {};

// Routines shared between Date and Temporal

// ES6 section 20.3.1.14 MakeDate (day, time)
double MakeDate(double day, double time);

// ES6 section 20.3.1.13 MakeDay (year, month, date)
double MakeDay(double year, double month, double date);

// ES6 section 20.3.1.12 MakeTime (hour, min, sec, ms)
double MakeTime(double hour, double min, double sec, double ms);

using DateBuffer = base::SmallVector<char, 128>;

enum class ToDateStringMode {};

// ES6 section 20.3.4.41.1 ToDateString(tv)
DateBuffer ToDateString(double time_val, DateCache* date_cache,
                        ToDateStringMode mode);

double ParseDateTimeString(Isolate* isolate, Handle<String> str);

}  // namespace internal
}  // namespace v8

#endif  // V8_DATE_DATE_H_