Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:18:28

0001 // Copyright 2021 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
0004 
0005 #ifndef INCLUDE_V8_DATE_H_
0006 #define INCLUDE_V8_DATE_H_
0007 
0008 #include "v8-local-handle.h"  // NOLINT(build/include_directory)
0009 #include "v8-object.h"        // NOLINT(build/include_directory)
0010 #include "v8config.h"         // NOLINT(build/include_directory)
0011 
0012 namespace v8 {
0013 
0014 class Context;
0015 
0016 /**
0017  * An instance of the built-in Date constructor (ECMA-262, 15.9).
0018  */
0019 class V8_EXPORT Date : public Object {
0020  public:
0021   static V8_WARN_UNUSED_RESULT MaybeLocal<Value> New(Local<Context> context,
0022                                                      double time);
0023 
0024   static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse(
0025       Local<Context> context,
0026       Local<String> date_string);
0027 
0028   /**
0029    * A specialization of Value::NumberValue that is more efficient
0030    * because we know the structure of this object.
0031    */
0032   double ValueOf() const;
0033 
0034   /**
0035    * Generates ISO string representation.
0036    */
0037   v8::Local<v8::String> ToISOString() const;
0038 
0039   /**
0040    * Generates UTC string representation.
0041    */
0042   v8::Local<v8::String> ToUTCString() const;
0043 
0044   V8_INLINE static Date* Cast(Value* value) {
0045 #ifdef V8_ENABLE_CHECKS
0046     CheckCast(value);
0047 #endif
0048     return static_cast<Date*>(value);
0049   }
0050 
0051  private:
0052   static void CheckCast(Value* obj);
0053 };
0054 
0055 }  // namespace v8
0056 
0057 #endif  // INCLUDE_V8_DATE_H_