11cb0ef41Sopenharmony_ci// Copyright 2021 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef INCLUDE_V8_DATE_H_
61cb0ef41Sopenharmony_ci#define INCLUDE_V8_DATE_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include "v8-local-handle.h"  // NOLINT(build/include_directory)
91cb0ef41Sopenharmony_ci#include "v8-object.h"        // NOLINT(build/include_directory)
101cb0ef41Sopenharmony_ci#include "v8config.h"         // NOLINT(build/include_directory)
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cinamespace v8 {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciclass Context;
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci/**
171cb0ef41Sopenharmony_ci * An instance of the built-in Date constructor (ECMA-262, 15.9).
181cb0ef41Sopenharmony_ci */
191cb0ef41Sopenharmony_ciclass V8_EXPORT Date : public Object {
201cb0ef41Sopenharmony_ci public:
211cb0ef41Sopenharmony_ci  static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
221cb0ef41Sopenharmony_ci                                                     double time);
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci  /**
251cb0ef41Sopenharmony_ci   * A specialization of Value::NumberValue that is more efficient
261cb0ef41Sopenharmony_ci   * because we know the structure of this object.
271cb0ef41Sopenharmony_ci   */
281cb0ef41Sopenharmony_ci  double ValueOf() const;
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci  /**
311cb0ef41Sopenharmony_ci   * Generates ISO string representation.
321cb0ef41Sopenharmony_ci   */
331cb0ef41Sopenharmony_ci  v8::Local<v8::String> ToISOString() const;
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ci  V8_INLINE static Date* Cast(Value* value) {
361cb0ef41Sopenharmony_ci#ifdef V8_ENABLE_CHECKS
371cb0ef41Sopenharmony_ci    CheckCast(value);
381cb0ef41Sopenharmony_ci#endif
391cb0ef41Sopenharmony_ci    return static_cast<Date*>(value);
401cb0ef41Sopenharmony_ci  }
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ci private:
431cb0ef41Sopenharmony_ci  static void CheckCast(Value* obj);
441cb0ef41Sopenharmony_ci};
451cb0ef41Sopenharmony_ci
461cb0ef41Sopenharmony_ci}  // namespace v8
471cb0ef41Sopenharmony_ci
481cb0ef41Sopenharmony_ci#endif  // INCLUDE_V8_DATE_H_
49