Module calendrical_calculations::chinese_based
source Β· Expand description
Chinese-like lunar calendars (Chinese, Dangi)
Structs§
- A type implementing
ChineseBased
for the Chinese calendar - chinese_based_date_from_fixed returns extra things for use in caching
- A type implementing
ChineseBased
for the Dangi (Korean) calendar - Marks the bounds of a lunar year
Constants§
- CHINESE_EPOCH π
- CHINESE_EPOCH_ISO π
- 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_LONGITUDE π
- 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§
- 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.
- Get a chinese based date from a fixed date, with the related ISO year
- Returns the number of days in the given
month
after the givennew_year
. Also returns the RataDie of the new moon beginning the next month. - Given a new year, calculate the number of days in the previous year
- Calculated the numbers of days in the given year
- Given the new year and a month/day pair, calculate the number of days until the first day of the given month
- Get a RataDie in the middle of a year; this is not necessarily meant for direct use in calculations; rather, it is useful for getting a RataDie guaranteed to be in a given year as input for other calculations like calculating the leap month in a year.
- Given that
new_year
is the first day of a leap year, find which month in the year is a leap month. Since the first month in which there are no major solar terms is a leap month, this function cycles through months until it finds the leap month, then returns the number of that month. This function assumes the date passed in is in a leap year and tests to ensure this is the case in debug mode by asserting that no more than thirteen months are analyzed. - Whether this year is a leap year
- The last month and day in this year
- 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
- Returns the number of days in the given (year, month). In the Chinese calendar, months start at each new moon, so this function finds the number of days between the new moon at the beginning of the given month and the new moon at the beginning of the next month.
- Returns the length of each month in the year, as well as a leap month index (1-indexed) if any. Month lengths are stored as true for 30-day, false for 29-day. In the case of no leap months, month 13 will have value false.
- 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
- 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).
- Get the fixed date of the nearest winter solstice, in the Chinese time zone, on or before a given fixed date.