Class HanCal
Extends
Calendar.
Construct a new Han algorithmic calendar object. This class encodes information about
a Han algorithmic calendar.
Defined in: HanCal.js.
Constructor Attributes | Constructor Name and Description |
---|---|
HanCal(params)
|
Method Attributes | Method Name and Description |
---|---|
equivalentCycleYear(year)
Return the equivalent year in the 2820 year cycle that begins on
Far 1, 474.
|
|
getLeapMonth(year, cycle)
Return the month of the year that is the leap month.
|
|
getMonLength(month, year)
Return the number of days in a particular month in a particular year.
|
|
getNumMonths(year, cycle)
Return the number of months in the given year.
|
|
getType()
Return the type of this calendar.
|
|
isLeapYear(year, cycle)
Return true if the given year is a leap year in the Han calendar.
|
|
newYears(year, cycle)
Return the date of Chinese New Years in the given calendar year.
|
Class Detail
HanCal(params)
- Parameters:
- {Object=} params
- optional parameters to load the calendrical data
Method Detail
{number}
equivalentCycleYear(year)
Return the equivalent year in the 2820 year cycle that begins on
Far 1, 474. This particular cycle obeys the cycle-of-years formula
whereas the others do not specifically. This cycle can be used as
a proxy for other years outside of the cycle by shifting them into
the cycle.
- Parameters:
- {number} year
- year to find the equivalent cycle year for
- Returns:
- {number} the equivalent cycle year
{number}
getLeapMonth(year, cycle)
Return the month of the year that is the leap month. If the given year is
not a leap year, then this method will return -1.
- Parameters:
- {number} year
- the year for which the leap year information is being sought
- {number=} cycle
- if the given year < 60, this can specify the cycle. If the cycle is not given, then the year should be given as elapsed years since the beginning of the epoch
- Returns:
- {number} the number of the month that is doubled in this leap year, or -1 if this is not a leap year
{number}
getMonLength(month, year)
Return the number of days in a particular month in a particular year. This function
can return a different number for a month depending on the year because of things
like leap years.
- Parameters:
- {number} month
- the elapsed month for which the length is sought
- {number} year
- the elapsed year within which that month can be found
- Returns:
- {number} the number of days within the given month in the given year
{number}
getNumMonths(year, cycle)
Return the number of months in the given year. The number of months in a year varies
for some luni-solar calendars because in some years, an extra month is needed to extend the
days in a year to an entire solar year. The month is represented as a 1-based number
where 1=first month, 2=second month, etc.
- Parameters:
- {number} year
- a year for which the number of months is sought
- {number=} cycle
- if the given year < 60, this can specify the cycle. If the cycle is not given, then the year should be given as elapsed years since the beginning of the epoch
- Returns:
- {number} The number of months in the given year
{string}
getType()
Return the type of this calendar.
- Returns:
- {string} the name of the type of this calendar
{boolean}
isLeapYear(year, cycle)
Return true if the given year is a leap year in the Han calendar.
If the year is given as a year/cycle combination, then the year should be in the
range [1,60] and the given cycle is the cycle in which the year is located. If
the year is greater than 60, then
it represents the total number of years elapsed in the proleptic calendar since
the beginning of the Chinese epoch in on 15 Feb, -2636 (Gregorian). In this
case, the cycle parameter is ignored.
- Parameters:
- {number} year
- the year for which the leap year information is being sought
- {number=} cycle
- if the given year < 60, this can specify the cycle. If the cycle is not given, then the year should be given as elapsed years since the beginning of the epoch
- Returns:
- {boolean} true if the given year is a leap year
{number}
newYears(year, cycle)
Return the date of Chinese New Years in the given calendar year.
- Parameters:
- {number} year
- the Chinese year for which the new year information is being sought
- {number=} cycle
- if the given year < 60, this can specify the cycle. If the cycle is not given, then the year should be given as elapsed years since the beginning of the epoch
- Returns:
- {number} the julian day of the beginning of the given year