pub fn get_leap_month_from_new_year<C: ChineseBased>(new_year: RataDie) -> u8
Expand description
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.
Calls to no_major_solar_term
have been inlined for increased efficiency.
Conceptually similar to code from Calendrical Calculations by Reingold & Dershowitz Lisp reference code: https://github.com/EdReingold/calendar-code2/blob/main/calendar.l#L5443-L5450