Module chinese_based

Source
Expand description

Chinese-like lunar calendars (Chinese, Dangi)

StructsΒ§

Chinese
A type implementing ChineseBased for the Chinese calendar
ChineseFromFixedResult
chinese_based_date_from_fixed returns extra things for use in caching
Dangi
A type implementing ChineseBased for the Dangi (Korean) calendar
YearBounds
Marks the bounds of a lunar year

ConstantsΒ§

CHINESE_EPOCH πŸ”’
CHINESE_EPOCH_ISO πŸ”’
CHINESE_LOCATION_POST_1929 πŸ”’
CHINESE_LOCATION_PRE_1929 πŸ”’
FIXED_1908 πŸ”’
FIXED_1912 πŸ”’
FIXED_1954 πŸ”’
FIXED_1961 πŸ”’
KOREAN_ELEVATION πŸ”’
KOREAN_EPOCH πŸ”’
KOREAN_EPOCH_ISO πŸ”’
KOREAN_LATITUDE πŸ”’
KOREAN_LOCATION_1908 πŸ”’
KOREAN_LOCATION_1912 πŸ”’
KOREAN_LOCATION_1954 πŸ”’
KOREAN_LOCATION_1961 πŸ”’
KOREAN_LOCATION_ORIGINAL πŸ”’
KOREAN_LONGITUDE πŸ”’
MAX_ITERS_FOR_MONTHS_OF_YEAR πŸ”’
UTC_OFFSET_1908 πŸ”’
UTC_OFFSET_1912 πŸ”’
UTC_OFFSET_1954 πŸ”’
UTC_OFFSET_1961 πŸ”’
UTC_OFFSET_ORIGINAL πŸ”’
The Korean Dangi calendar relies on knowing the current day at the moment of a new moon; however, this can vary depending on location. As such, new moon calculations are based on the time in Seoul. Before 1908, local time was used, represented as UTC+(3809/450 h). This changed multiple times as different standard timezones were adopted in Korea. Currently, UTC+9h is used.
UTC_OFFSET_POST_1929 πŸ”’
UTC_OFFSET_PRE_1929 πŸ”’
The Chinese calendar relies on knowing the current day at the moment of a new moon; however, this can vary depending on location. As such, new moon calculations are based on the time in Beijing. Before 1929, local time was used, represented as UTC+(1397/180 h). In 1929, China adopted a standard time zone based on 120 degrees of longitude, meaning from 1929 onward, all new moon calculations are based on UTC+8h.

TraitsΒ§

ChineseBased
The trait ChineseBased is used by Chinese-based calendars to perform computations shared by such calendar. To do so, calendars should:

FunctionsΒ§

bind_winter_solstice πŸ”’
This function forces the RataDie to be on December 20, 21, 22, or 23. It was created for practical considerations and is not in the text.
chinese_based_date_from_fixed
Get a chinese based date from a fixed date, with the related ISO year
days_in_month
Returns the number of days in the given month after the given new_year. Also returns the RataDie of the new moon beginning the next month.
days_in_prev_year
Given a new year, calculate the number of days in the previous year
days_in_provided_year
Calculated the numbers of days in the given year
days_until_month
Given the new year and a month/day pair, calculate the number of days until the first day of the given month
fixed_mid_year_from_year
Get a RataDie in the middle of a year.
get_leap_month_from_new_year
Given that new_year is the first day of a leap year, find which month in the year is a leap month.
is_leap_year
Whether this year is a leap year
last_month_day_in_year
The last month and day in this year
major_solar_term_from_fixed πŸ”’
Get the current major solar term of a fixed date, output as an integer from 1..=12.
midnight πŸ”’
Universal time of midnight at start of a Moment’s day at the observation location
month_days
Returns the number of days in the given (year, month).
month_structure_for_year
Returns the length of each month in the year, as well as a leap month index (1-indexed) if any.
new_moon_before πŸ”’
The fixed date in standard time at the observation location of the previous new moon before a given Moment.
new_moon_on_or_after πŸ”’
The fixed date in standard time at the observation location of the next new moon on or after a given Moment.
new_year_in_sui πŸ”’
Determines the fixed date of the lunar new year given the start of its corresponding solar year (ζ­²), which is also the winter solstice
new_year_on_or_before_fixed_date πŸ”’
Get the fixed date of the nearest Lunar New Year on or before a given fixed date. This function also returns the solstice following a given date for optimization (see #3743).
winter_solstice_on_or_before πŸ”’
Get the fixed date of the nearest winter solstice, in the Chinese time zone, on or before a given fixed date.