Package org.mozilla.javascript
Class NativeDate
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.mozilla.javascript.IdScriptableObject
org.mozilla.javascript.NativeDate
- All Implemented Interfaces:
Serializable
,ConstProperties
,DebuggableObject
,IdFunctionCall
,Scriptable
,SymbolScriptable
This class implements the Date native object. See ECMA 15.9.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private double
private static final Object
private static final double
private static final double
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final String
private static final DateFormat
private static final DateFormat
private static final DateFormat
private static final double
private static final int
private static final int
private static final double
private static final double
private static final double
private static final double
private static final double
private static final double
private static final double
private static final double
private static final double
private static final long
private static final TimeZone
private static final DateFormat
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
append0PaddedUint
(StringBuilder sb, int i, int minWidth) private static void
appendMonthName
(StringBuilder sb, int index) private static void
appendWeekDayName
(StringBuilder sb, int index) private static String
date_format
(double t, int methodId) private static double
date_msecFromArgs
(Object[] args) private static double
date_msecFromDate
(double year, double mon, double mday, double hour, double min, double sec, double msec) private static double
private static int
DateFromTime
(double t) private static double
Day
(double t) private static double
DayFromMonth
(int m, int year) private static double
DayFromYear
(double y) private static double
DaylightSavingTA
(double t) private static int
DaysInMonth
(int year, int month) private static double
DaysInYear
(double year) private static int
EquivalentYear
(int year) execIdCall
(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) 'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected void
protected int
Return the name of the class.getDefaultValue
(Class<?> typeHint) Implements the [[DefaultValue]] internal method.(package private) double
private static int
HourFromTime
(double t) (package private) static void
init
(Scriptable scope, boolean sealed) protected void
initPrototypeId
(int id) private static double
internalUTC
(double t) private static boolean
IsLeapYear
(int year) private static String
js_toISOString
(double t) private static String
js_toUTCString
(double date) private static Object
jsConstructor
(Object[] args) private static double
jsStaticFunction_UTC
(Object[] args) private static double
LocalTime
(double t) private static double
private static double
MakeDate
(double day, double time) private static double
MakeDay
(double year, double month, double date) private static double
private static double
MakeTime
(double hour, double min, double sec, double ms) private static int
MinFromTime
(double t) private static int
MonthFromTime
(double t) private static int
msFromTime
(double t) private static double
now()
private static double
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'
orYYYY-MM-DD'T'HH:mm:ss.sss[+-]hh:mm
private static int
SecFromTime
(double t) private static double
TimeClip
(double d) private static double
TimeFromYear
(double y) private static double
TimeWithinDay
(double t) private static String
toLocale_helper
(double t, int methodId) private static int
WeekDay
(double t) private static int
YearFromTime
(double t) Methods inherited from class org.mozilla.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, findInstanceIdInfo, findPrototypeId, get, get, getAttributes, getAttributes, getIds, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes, setInstanceIdAttributes, setInstanceIdValue
Methods inherited from class org.mozilla.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
DATE_TAG
-
js_NaN_date_str
- See Also:
-
HalfTimeDomain
private static final double HalfTimeDomain- See Also:
-
HoursPerDay
private static final double HoursPerDay- See Also:
-
MinutesPerHour
private static final double MinutesPerHour- See Also:
-
SecondsPerMinute
private static final double SecondsPerMinute- See Also:
-
msPerSecond
private static final double msPerSecond- See Also:
-
MinutesPerDay
private static final double MinutesPerDay- See Also:
-
SecondsPerDay
private static final double SecondsPerDay- See Also:
-
SecondsPerHour
private static final double SecondsPerHour- See Also:
-
msPerDay
private static final double msPerDay- See Also:
-
msPerHour
private static final double msPerHour- See Also:
-
msPerMinute
private static final double msPerMinute- See Also:
-
MAXARGS
private static final int MAXARGS- See Also:
-
ConstructorId_now
private static final int ConstructorId_now- See Also:
-
ConstructorId_parse
private static final int ConstructorId_parse- See Also:
-
ConstructorId_UTC
private static final int ConstructorId_UTC- See Also:
-
Id_constructor
private static final int Id_constructor- See Also:
-
Id_toString
private static final int Id_toString- See Also:
-
Id_toTimeString
private static final int Id_toTimeString- See Also:
-
Id_toDateString
private static final int Id_toDateString- See Also:
-
Id_toLocaleString
private static final int Id_toLocaleString- See Also:
-
Id_toLocaleTimeString
private static final int Id_toLocaleTimeString- See Also:
-
Id_toLocaleDateString
private static final int Id_toLocaleDateString- See Also:
-
Id_toUTCString
private static final int Id_toUTCString- See Also:
-
Id_toSource
private static final int Id_toSource- See Also:
-
Id_valueOf
private static final int Id_valueOf- See Also:
-
Id_getTime
private static final int Id_getTime- See Also:
-
Id_getYear
private static final int Id_getYear- See Also:
-
Id_getFullYear
private static final int Id_getFullYear- See Also:
-
Id_getUTCFullYear
private static final int Id_getUTCFullYear- See Also:
-
Id_getMonth
private static final int Id_getMonth- See Also:
-
Id_getUTCMonth
private static final int Id_getUTCMonth- See Also:
-
Id_getDate
private static final int Id_getDate- See Also:
-
Id_getUTCDate
private static final int Id_getUTCDate- See Also:
-
Id_getDay
private static final int Id_getDay- See Also:
-
Id_getUTCDay
private static final int Id_getUTCDay- See Also:
-
Id_getHours
private static final int Id_getHours- See Also:
-
Id_getUTCHours
private static final int Id_getUTCHours- See Also:
-
Id_getMinutes
private static final int Id_getMinutes- See Also:
-
Id_getUTCMinutes
private static final int Id_getUTCMinutes- See Also:
-
Id_getSeconds
private static final int Id_getSeconds- See Also:
-
Id_getUTCSeconds
private static final int Id_getUTCSeconds- See Also:
-
Id_getMilliseconds
private static final int Id_getMilliseconds- See Also:
-
Id_getUTCMilliseconds
private static final int Id_getUTCMilliseconds- See Also:
-
Id_getTimezoneOffset
private static final int Id_getTimezoneOffset- See Also:
-
Id_setTime
private static final int Id_setTime- See Also:
-
Id_setMilliseconds
private static final int Id_setMilliseconds- See Also:
-
Id_setUTCMilliseconds
private static final int Id_setUTCMilliseconds- See Also:
-
Id_setSeconds
private static final int Id_setSeconds- See Also:
-
Id_setUTCSeconds
private static final int Id_setUTCSeconds- See Also:
-
Id_setMinutes
private static final int Id_setMinutes- See Also:
-
Id_setUTCMinutes
private static final int Id_setUTCMinutes- See Also:
-
Id_setHours
private static final int Id_setHours- See Also:
-
Id_setUTCHours
private static final int Id_setUTCHours- See Also:
-
Id_setDate
private static final int Id_setDate- See Also:
-
Id_setUTCDate
private static final int Id_setUTCDate- See Also:
-
Id_setMonth
private static final int Id_setMonth- See Also:
-
Id_setUTCMonth
private static final int Id_setUTCMonth- See Also:
-
Id_setFullYear
private static final int Id_setFullYear- See Also:
-
Id_setUTCFullYear
private static final int Id_setUTCFullYear- See Also:
-
Id_setYear
private static final int Id_setYear- See Also:
-
Id_toISOString
private static final int Id_toISOString- See Also:
-
Id_toJSON
private static final int Id_toJSON- See Also:
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID- See Also:
-
Id_toGMTString
private static final int Id_toGMTString- See Also:
-
thisTimeZone
-
LocalTZA
private static final double LocalTZA -
timeZoneFormatter
-
localeDateTimeFormatter
-
localeDateFormatter
-
localeTimeFormatter
-
date
private double date
-
-
Constructor Details
-
NativeDate
private NativeDate()
-
-
Method Details
-
init
-
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 interfaceScriptable
- Specified by:
getClassName
in classScriptableObject
-
getDefaultValue
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 interfaceScriptable
- Overrides:
getDefaultValue
in classScriptableObject
- Parameters:
typeHint
- the type hint- Returns:
- the default value for the object
See ECMA 8.6.2.6.
-
getJSTimeValue
double getJSTimeValue() -
fillConstructorProperties
- Overrides:
fillConstructorProperties
in classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id) - Overrides:
initPrototypeId
in classIdScriptableObject
-
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 interfaceIdFunctionCall
- Overrides:
execIdCall
in classIdScriptableObject
-
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(double t) -
EquivalentYear
private static int EquivalentYear(int year) -
LocalTime
private static double LocalTime(double t) -
internalUTC
private static double internalUTC(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
-
jsStaticFunction_UTC
-
parseISOString
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
-
date_format
-
jsConstructor
-
toLocale_helper
-
js_toUTCString
-
js_toISOString
-
append0PaddedUint
-
appendMonthName
-
appendWeekDayName
-
makeTime
-
makeDate
-
findPrototypeId
- Overrides:
findPrototypeId
in classIdScriptableObject
-