Package org.htmlunit.corejs.javascript
Class NativeDate
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.IdScriptableObject
-
- org.htmlunit.corejs.javascript.NativeDate
-
- All Implemented Interfaces:
java.io.Serializable,ConstProperties,DebuggableObject,IdFunctionCall,Scriptable,SymbolScriptable
final class NativeDate extends IdScriptableObject
This class implements the Date native object. See ECMA 15.9.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static intConstructorId_nowprivate static intConstructorId_parseprivate static intConstructorId_UTCprivate doubledateprivate static java.lang.ObjectDATE_TAGprivate static doubleHalfTimeDomainprivate static doubleHoursPerDayprivate static intId_constructorprivate static intId_getDateprivate static intId_getDayprivate static intId_getFullYearprivate static intId_getHoursprivate static intId_getMillisecondsprivate static intId_getMinutesprivate static intId_getMonthprivate static intId_getSecondsprivate static intId_getTimeprivate static intId_getTimezoneOffsetprivate static intId_getUTCDateprivate static intId_getUTCDayprivate static intId_getUTCFullYearprivate static intId_getUTCHoursprivate static intId_getUTCMillisecondsprivate static intId_getUTCMinutesprivate static intId_getUTCMonthprivate static intId_getUTCSecondsprivate static intId_getYearprivate static intId_setDateprivate static intId_setFullYearprivate static intId_setHoursprivate static intId_setMillisecondsprivate static intId_setMinutesprivate static intId_setMonthprivate static intId_setSecondsprivate static intId_setTimeprivate static intId_setUTCDateprivate static intId_setUTCFullYearprivate static intId_setUTCHoursprivate static intId_setUTCMillisecondsprivate static intId_setUTCMinutesprivate static intId_setUTCMonthprivate static intId_setUTCSecondsprivate static intId_setYearprivate static intId_toDateStringprivate static intId_toGMTStringprivate static intId_toISOStringprivate static intId_toJSONprivate static intId_toLocaleDateStringprivate static intId_toLocaleStringprivate static intId_toLocaleTimeStringprivate static intId_toSourceprivate static intId_toStringprivate static intId_toTimeStringprivate static intId_toUTCStringprivate static intId_valueOfprivate static java.lang.Stringjs_NaN_date_strprivate static java.text.DateFormatlocaleDateFormatterprivate static java.text.DateFormatlocaleDateTimeFormatterprivate static java.text.DateFormatlocaleTimeFormatterprivate static intMAX_PROTOTYPE_IDprivate static intMAXARGSprivate static doubleMinutesPerDayprivate static doubleMinutesPerHourprivate static doublemsPerDayprivate static doublemsPerHourprivate static doublemsPerMinuteprivate static doublemsPerSecondprivate static doubleSecondsPerDayprivate static doubleSecondsPerHourprivate static doubleSecondsPerMinuteprivate static longserialVersionUIDprivate static java.text.DateFormattimeZoneFormatter-
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Modifier Constructor Description privateNativeDate()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidappend0PaddedUint(java.lang.StringBuilder sb, int i, int minWidth)private static voidappendMonthName(java.lang.StringBuilder sb, int index)private static voidappendWeekDayName(java.lang.StringBuilder sb, int index)private static java.lang.Stringdate_format(Context cx, double t, int methodId)private static doubledate_msecFromArgs(java.lang.Object[] args)private static doubledate_msecFromDate(double year, double mon, double mday, double hour, double min, double sec, double msec)private static doubledate_parseString(Context cx, java.lang.String s)private static intDateFromTime(double t)private static doubleDay(double t)private static doubleDayFromMonth(int m, int year)private static doubleDayFromYear(double y)private static doubleDaylightSavingTA(Context cx, double t)private static intDaysInMonth(int year, int month)private static doubleDaysInYear(double year)private static intEquivalentYear(int year)java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected voidfillConstructorProperties(IdFunctionObject ctor)protected intfindPrototypeId(java.lang.String s)java.lang.StringgetClassName()Return the name of the class.java.lang.ObjectgetDefaultValue(java.lang.Class<?> typeHint)Implements the [[DefaultValue]] internal method.(package private) doublegetJSTimeValue()private static intHourFromTime(double t)(package private) static voidinit(Scriptable scope, boolean sealed)protected voidinitPrototypeId(int id)private static doubleinternalUTC(Context cx, double t)private static booleanIsLeapYear(int year)private static java.lang.Stringjs_toISOString(double t)private static java.lang.Stringjs_toUTCString(double date)private static java.lang.ObjectjsConstructor(Context cx, java.lang.Object[] args)private static doublejsStaticFunction_UTC(java.lang.Object[] args)private static doubleLocalTime(Context cx, double t)private static doublemakeDate(Context cx, double date, java.lang.Object[] args, int methodId)private static doubleMakeDate(double day, double time)private static doubleMakeDay(double year, double month, double date)private static doublemakeTime(Context cx, double date, java.lang.Object[] args, int methodId)private static doubleMakeTime(double hour, double min, double sec, double ms)private static intMinFromTime(double t)private static intMonthFromTime(double t)private static intmsFromTime(double t)private static doublenow()private static doubleparseISOString(Context cx, java.lang.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'orYYYY-MM-DD'T'HH:mm:ss.sss[+-]hh:mmprivate static intSecFromTime(double t)private static doubleTimeClip(double d)private static doubleTimeFromYear(double y)private static doubleTimeWithinDay(double t)private static java.lang.StringtoLocale_helper(double t, int methodId)private static intWeekDay(double t)private static intYearFromTime(double t)-
Methods inherited from class org.htmlunit.corejs.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.htmlunit.corejs.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, defineProperty, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getBase, getBase, 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, putImpl, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
DATE_TAG
private static final java.lang.Object DATE_TAG
-
js_NaN_date_str
private static final java.lang.String js_NaN_date_str
- See Also:
- Constant Field Values
-
HalfTimeDomain
private static final double HalfTimeDomain
- See Also:
- Constant Field Values
-
HoursPerDay
private static final double HoursPerDay
- See Also:
- Constant Field Values
-
MinutesPerHour
private static final double MinutesPerHour
- See Also:
- Constant Field Values
-
SecondsPerMinute
private static final double SecondsPerMinute
- See Also:
- Constant Field Values
-
msPerSecond
private static final double msPerSecond
- See Also:
- Constant Field Values
-
MinutesPerDay
private static final double MinutesPerDay
- See Also:
- Constant Field Values
-
SecondsPerDay
private static final double SecondsPerDay
- See Also:
- Constant Field Values
-
SecondsPerHour
private static final double SecondsPerHour
- See Also:
- Constant Field Values
-
msPerDay
private static final double msPerDay
- See Also:
- Constant Field Values
-
msPerHour
private static final double msPerHour
- See Also:
- Constant Field Values
-
msPerMinute
private static final double msPerMinute
- See Also:
- Constant Field Values
-
MAXARGS
private static final int MAXARGS
- See Also:
- Constant Field Values
-
ConstructorId_now
private static final int ConstructorId_now
- See Also:
- Constant Field Values
-
ConstructorId_parse
private static final int ConstructorId_parse
- See Also:
- Constant Field Values
-
ConstructorId_UTC
private static final int ConstructorId_UTC
- See Also:
- Constant Field Values
-
Id_constructor
private static final int Id_constructor
- See Also:
- Constant Field Values
-
Id_toString
private static final int Id_toString
- See Also:
- Constant Field Values
-
Id_toTimeString
private static final int Id_toTimeString
- See Also:
- Constant Field Values
-
Id_toDateString
private static final int Id_toDateString
- See Also:
- Constant Field Values
-
Id_toLocaleString
private static final int Id_toLocaleString
- See Also:
- Constant Field Values
-
Id_toLocaleTimeString
private static final int Id_toLocaleTimeString
- See Also:
- Constant Field Values
-
Id_toLocaleDateString
private static final int Id_toLocaleDateString
- See Also:
- Constant Field Values
-
Id_toUTCString
private static final int Id_toUTCString
- See Also:
- Constant Field Values
-
Id_toSource
private static final int Id_toSource
- See Also:
- Constant Field Values
-
Id_valueOf
private static final int Id_valueOf
- See Also:
- Constant Field Values
-
Id_getTime
private static final int Id_getTime
- See Also:
- Constant Field Values
-
Id_getYear
private static final int Id_getYear
- See Also:
- Constant Field Values
-
Id_getFullYear
private static final int Id_getFullYear
- See Also:
- Constant Field Values
-
Id_getUTCFullYear
private static final int Id_getUTCFullYear
- See Also:
- Constant Field Values
-
Id_getMonth
private static final int Id_getMonth
- See Also:
- Constant Field Values
-
Id_getUTCMonth
private static final int Id_getUTCMonth
- See Also:
- Constant Field Values
-
Id_getDate
private static final int Id_getDate
- See Also:
- Constant Field Values
-
Id_getUTCDate
private static final int Id_getUTCDate
- See Also:
- Constant Field Values
-
Id_getDay
private static final int Id_getDay
- See Also:
- Constant Field Values
-
Id_getUTCDay
private static final int Id_getUTCDay
- See Also:
- Constant Field Values
-
Id_getHours
private static final int Id_getHours
- See Also:
- Constant Field Values
-
Id_getUTCHours
private static final int Id_getUTCHours
- See Also:
- Constant Field Values
-
Id_getMinutes
private static final int Id_getMinutes
- See Also:
- Constant Field Values
-
Id_getUTCMinutes
private static final int Id_getUTCMinutes
- See Also:
- Constant Field Values
-
Id_getSeconds
private static final int Id_getSeconds
- See Also:
- Constant Field Values
-
Id_getUTCSeconds
private static final int Id_getUTCSeconds
- See Also:
- Constant Field Values
-
Id_getMilliseconds
private static final int Id_getMilliseconds
- See Also:
- Constant Field Values
-
Id_getUTCMilliseconds
private static final int Id_getUTCMilliseconds
- See Also:
- Constant Field Values
-
Id_getTimezoneOffset
private static final int Id_getTimezoneOffset
- See Also:
- Constant Field Values
-
Id_setTime
private static final int Id_setTime
- See Also:
- Constant Field Values
-
Id_setMilliseconds
private static final int Id_setMilliseconds
- See Also:
- Constant Field Values
-
Id_setUTCMilliseconds
private static final int Id_setUTCMilliseconds
- See Also:
- Constant Field Values
-
Id_setSeconds
private static final int Id_setSeconds
- See Also:
- Constant Field Values
-
Id_setUTCSeconds
private static final int Id_setUTCSeconds
- See Also:
- Constant Field Values
-
Id_setMinutes
private static final int Id_setMinutes
- See Also:
- Constant Field Values
-
Id_setUTCMinutes
private static final int Id_setUTCMinutes
- See Also:
- Constant Field Values
-
Id_setHours
private static final int Id_setHours
- See Also:
- Constant Field Values
-
Id_setUTCHours
private static final int Id_setUTCHours
- See Also:
- Constant Field Values
-
Id_setDate
private static final int Id_setDate
- See Also:
- Constant Field Values
-
Id_setUTCDate
private static final int Id_setUTCDate
- See Also:
- Constant Field Values
-
Id_setMonth
private static final int Id_setMonth
- See Also:
- Constant Field Values
-
Id_setUTCMonth
private static final int Id_setUTCMonth
- See Also:
- Constant Field Values
-
Id_setFullYear
private static final int Id_setFullYear
- See Also:
- Constant Field Values
-
Id_setUTCFullYear
private static final int Id_setUTCFullYear
- See Also:
- Constant Field Values
-
Id_setYear
private static final int Id_setYear
- See Also:
- Constant Field Values
-
Id_toISOString
private static final int Id_toISOString
- See Also:
- Constant Field Values
-
Id_toJSON
private static final int Id_toJSON
- See Also:
- Constant Field Values
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID
- See Also:
- Constant Field Values
-
Id_toGMTString
private static final int Id_toGMTString
- See Also:
- Constant Field Values
-
timeZoneFormatter
private static final java.text.DateFormat timeZoneFormatter
-
localeDateTimeFormatter
private static final java.text.DateFormat localeDateTimeFormatter
-
localeDateFormatter
private static final java.text.DateFormat localeDateFormatter
-
localeTimeFormatter
private static final java.text.DateFormat localeTimeFormatter
-
date
private double date
-
-
Method Detail
-
init
static void init(Scriptable scope, boolean sealed)
-
getClassName
public java.lang.String getClassName()
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class<?> typeHint)
Description copied from class:ScriptableObjectImplements 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
hintof null means "no hint".- Specified by:
getDefaultValuein interfaceScriptable- Overrides:
getDefaultValuein classScriptableObject- 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:
fillConstructorPropertiesin classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id)
- Overrides:
initPrototypeIdin classIdScriptableObject
-
execIdCall
public java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.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:
execIdCallin interfaceIdFunctionCall- Overrides:
execIdCallin 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(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(java.lang.Object[] args)
-
jsStaticFunction_UTC
private static double jsStaticFunction_UTC(java.lang.Object[] args)
-
parseISOString
private static double parseISOString(Context cx, java.lang.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, java.lang.String s)
-
date_format
private static java.lang.String date_format(Context cx, double t, int methodId)
-
jsConstructor
private static java.lang.Object jsConstructor(Context cx, java.lang.Object[] args)
-
toLocale_helper
private static java.lang.String toLocale_helper(double t, int methodId)
-
js_toUTCString
private static java.lang.String js_toUTCString(double date)
-
js_toISOString
private static java.lang.String js_toISOString(double t)
-
append0PaddedUint
private static void append0PaddedUint(java.lang.StringBuilder sb, int i, int minWidth)
-
appendMonthName
private static void appendMonthName(java.lang.StringBuilder sb, int index)
-
appendWeekDayName
private static void appendWeekDayName(java.lang.StringBuilder sb, int index)
-
makeTime
private static double makeTime(Context cx, double date, java.lang.Object[] args, int methodId)
-
makeDate
private static double makeDate(Context cx, double date, java.lang.Object[] args, int methodId)
-
findPrototypeId
protected int findPrototypeId(java.lang.String s)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
-