Class

HanCal

HanCal(paramsopt)

Construct a new Han algorithmic calendar object. This class encodes information about a Han algorithmic calendar.

Constructor

# new HanCal(paramsopt)

Parameters:
Name Type Attributes Description
params Object <optional>

optional parameters to load the calendrical data

View Source HanCal.js, line 40

Extends

Methods

# equivalentCycleYear(year) → {number}

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:
Name Type Description
year number

year to find the equivalent cycle year for

View Source HanCal.js, line 240

the equivalent cycle year

number

# getLeapMonth(year, cycleopt) → {number}

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:
Name Type Attributes Description
year number

the year for which the leap year information is being sought

cycle number <optional>

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

View Source HanCal.js, line 276

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) → {number}

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:
Name Type Description
month number

the elapsed month for which the length is sought

year number

the elapsed year within which that month can be found

Overrides:

View Source HanCal.js, line 223

the number of days within the given month in the given year

number

# getNumMonths(year, cycleopt) → {number}

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:
Name Type Attributes Description
year number

a year for which the number of months is sought

cycle number <optional>

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

Overrides:

View Source HanCal.js, line 210

The number of months in the given year

number

# getType() → {string}

Return the type of this calendar.

Overrides:

View Source HanCal.js, line 319

the name of the type of this calendar

string

# isLeapYear(year, cycleopt) → {boolean}

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:
Name Type Attributes Description
year number

the year for which the leap year information is being sought

cycle number <optional>

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

Overrides:

View Source HanCal.js, line 260

true if the given year is a leap year

boolean

# newYears(year, cycleopt) → {number}

Return the date of Chinese New Years in the given calendar year.

Parameters:
Name Type Attributes Description
year number

the Chinese year for which the new year information is being sought

cycle number <optional>

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

View Source HanCal.js, line 304

the julian day of the beginning of the given year

number