Class HanDate
Extends
Date.
Construct a new Han date object. The constructor parameters can
contain any of the following properties:
- unixtime - sets the time of this instance according to the given
unix time. Unix time is the number of milliseconds since midnight on Jan 1, 1970, Gregorian
- julianday - sets the time of this instance according to the given Julian Day instance or the Julian Day given as a float
- cycle - any integer giving the number of 60-year cycle in which the date is located. If the cycle is not given but the year is, it is assumed that the year parameter is a fictitious linear count of years since the beginning of the epoch, much like other calendars. This linear count is never used. If both the cycle and year are given, the year is wrapped to the range 0 to 60 and treated as if it were a year in the regular 60-year cycle.
- year - any integer, including 0
- month - 1 to 12, where 1 means Farvardin, 2 means Ordibehesht, etc.
- day - 1 to 31
- hour - 0 to 23. A formatter is used to display 12 hour clocks, but this representation is always done with an unambiguous 24 hour representation
- minute - 0 to 59
- second - 0 to 59
- millisecond - 0 to 999
- timezone - the TimeZone instance or time zone name as a string of this han date. The date/time is kept in the local time. The time zone is used later if this date is formatted according to a different time zone and the difference has to be calculated, or when the date format has a time zone component in it.
- locale - locale for this han date. If the time zone is not given, it can be inferred from this locale. For locales that span multiple time zones, the one with the largest population is chosen as the one that represents the locale.
- date - use the given intrinsic Javascript date to initialize this one.
If the constructor is called with no arguments at all or if none of the properties listed above from unixtime through millisecond are present, then the date components are filled in with the current date at the time of instantiation. Note that if you do not give the time zone when defaulting to the current time and the time zone for all of ilib was not set with ilib.setTimeZone(), then the time zone will default to UTC ("Universal Time, Coordinated" or "Greenwich Mean Time").
If any of the properties from year through millisecond are not specified in the params, it is assumed that they have the smallest possible value in the range for the property (zero or one).
Defined in: ilib-full-dyn.js.
Constructor Attributes | Constructor Name and Description |
---|---|
HanDate(params)
|
Method Attributes | Method Name and Description |
---|---|
Return the name of the calendar that governs this date.
|
|
Return the Chinese cycle number of this date.
|
|
Return the year within the Chinese cycle of this date.
|
|
Return the day of the week of this date.
|
|
Return the ordinal day of the year.
|
|
getEra()
Return the era for this date as a number.
|
|
Return whether the month of this date is a leap month in the Chinese Han
calendar.
|
|
Return whether the year of this date is a leap year in the Chinese Han
calendar.
|
|
newRd(params)
Return a new RD for this date type using the given params.
|
- Parameters:
- {Object=} params
- parameters that govern the settings and behaviour of this Han date
- Returns:
- {string} a string giving the name of the calendar
- Returns:
- {number} the current Chinese cycle
- Returns:
- {number} the year within the current Chinese cycle
- Returns:
- {number} the day of the week
- Returns:
- {number} the ordinal day of the year
- Returns:
- {number} 1 if this date is in the common era, -1 if it is before the common era
- Returns:
- {boolean} true if the month of this date is a leap month in the Chinese Han calendar.
- Returns:
- {boolean} true if the year of this date is a leap year in the Chinese Han calendar.
- Parameters:
- {Object=} params
- the parameters used to create this rata die instance
- Returns:
- {RataDie} the new RD instance for the given params