Class NativeDate

All Implemented Interfaces:
Serializable, ConstProperties, DebuggableObject, IdFunctionCall, Scriptable, SymbolScriptable

final class NativeDate extends IdScriptableObject
This class implements the Date native object. See ECMA 15.9.
  • Field Details

  • Constructor Details

    • NativeDate

      private NativeDate()
  • Method Details

    • init

      static void init(Scriptable scope, boolean sealed)
    • getClassName

      public String getClassName()
      Description copied from class: ScriptableObject
      Return the name of the class.

      This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.

      Specified by:
      getClassName in interface Scriptable
      Specified by:
      getClassName in class ScriptableObject
    • getDefaultValue

      public Object getDefaultValue(Class<?> typeHint)
      Description copied from class: ScriptableObject
      Implements the [[DefaultValue]] internal method.

      Note that the toPrimitive conversion is a no-op for every type other than Object, for which [[DefaultValue]] is called. See ECMA 9.1.

      A hint of null means "no hint".

      Specified by:
      getDefaultValue in interface Scriptable
      Overrides:
      getDefaultValue in class ScriptableObject
      Parameters:
      typeHint - the type hint
      Returns:
      the default value for the object

      See ECMA 8.6.2.6.

    • getJSTimeValue

      double getJSTimeValue()
    • fillConstructorProperties

      protected void fillConstructorProperties(IdFunctionObject ctor)
      Overrides:
      fillConstructorProperties in class IdScriptableObject
    • initPrototypeId

      protected void initPrototypeId(int id)
      Overrides:
      initPrototypeId in class IdScriptableObject
    • execIdCall

      public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
      Description copied from class: IdScriptableObject
      'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.
      Specified by:
      execIdCall in interface IdFunctionCall
      Overrides:
      execIdCall in class IdScriptableObject
    • Day

      private static double Day(double t)
    • TimeWithinDay

      private static double TimeWithinDay(double t)
    • IsLeapYear

      private static boolean IsLeapYear(int year)
    • DayFromYear

      private static double DayFromYear(double y)
    • TimeFromYear

      private static double TimeFromYear(double y)
    • YearFromTime

      private static int YearFromTime(double t)
    • DayFromMonth

      private static double DayFromMonth(int m, int year)
    • DaysInYear

      private static double DaysInYear(double year)
    • DaysInMonth

      private static int DaysInMonth(int year, int month)
    • MonthFromTime

      private static int MonthFromTime(double t)
    • DateFromTime

      private static int DateFromTime(double t)
    • WeekDay

      private static int WeekDay(double t)
    • now

      private static double now()
    • DaylightSavingTA

      private static double DaylightSavingTA(Context cx, double t)
    • EquivalentYear

      private static int EquivalentYear(int year)
    • LocalTime

      private static double LocalTime(Context cx, double t)
    • internalUTC

      private static double internalUTC(Context cx, double t)
    • HourFromTime

      private static int HourFromTime(double t)
    • MinFromTime

      private static int MinFromTime(double t)
    • SecFromTime

      private static int SecFromTime(double t)
    • msFromTime

      private static int msFromTime(double t)
    • MakeTime

      private static double MakeTime(double hour, double min, double sec, double ms)
    • MakeDay

      private static double MakeDay(double year, double month, double date)
    • MakeDate

      private static double MakeDate(double day, double time)
    • TimeClip

      private static double TimeClip(double d)
    • date_msecFromDate

      private static double date_msecFromDate(double year, double mon, double mday, double hour, double min, double sec, double msec)
    • date_msecFromArgs

      private static double date_msecFromArgs(Object[] args)
    • jsStaticFunction_UTC

      private static double jsStaticFunction_UTC(Object[] args)
    • parseISOString

      private static double parseISOString(Context cx, String s)
      15.9.1.15 Date Time String Format
      Parse input string according to simplified ISO-8601 Extended Format:
      • YYYY-MM-DD'T'HH:mm:ss.sss'Z'
      • or YYYY-MM-DD'T'HH:mm:ss.sss[+-]hh:mm
    • date_parseString

      private static double date_parseString(Context cx, String s)
    • date_format

      private static String date_format(Context cx, double t, int methodId)
    • jsConstructor

      private static Object jsConstructor(Context cx, Object[] args)
    • toLocale_helper

      private static String toLocale_helper(double t, int methodId)
    • js_toUTCString

      private static String js_toUTCString(double date)
    • js_toISOString

      private static String js_toISOString(double t)
    • append0PaddedUint

      private static void append0PaddedUint(StringBuilder sb, int i, int minWidth)
    • appendMonthName

      private static void appendMonthName(StringBuilder sb, int index)
    • appendWeekDayName

      private static void appendWeekDayName(StringBuilder sb, int index)
    • makeTime

      private static double makeTime(Context cx, double date, Object[] args, int methodId)
    • makeDate

      private static double makeDate(Context cx, double date, Object[] args, int methodId)
    • findPrototypeId

      protected int findPrototypeId(String s)
      Overrides:
      findPrototypeId in class IdScriptableObject