Expand description
Gregorian calendar.
Implements the proleptic Gregorian calendar with Julian Day Number conversions, following the algorithms in Dershowitz & Reingold, Calendrical Calculations (4th ed., Cambridge University Press, 2018).
§Historical Context
The Gregorian calendar was introduced by Pope Gregory XIII in October 1582 to correct the Julian calendar’s accumulated drift (~10 days by the 16th century). It refined the leap year rule: divisible by 4, except centuries not divisible by 400. This keeps the calendar synchronized with the vernal equinox to within 1 day per 3,236 years.
This implementation uses the proleptic Gregorian calendar, extending the Gregorian rules backward before 1582 for computational uniformity. Year 0 corresponds to 1 BCE in historical reckoning (astronomical year numbering).
Structs§
- Gregorian
Date - A date in the proleptic Gregorian calendar.
Enums§
- Gregorian
Month - The 12 months of the Gregorian calendar.
Constants§
- GREGORIAN_
EPOCH_ JDN - Julian Day Number of the Gregorian epoch: January 1, 1 CE (proleptic).
Functions§
- gregorian_
is_ leap - Whether a Gregorian year is a leap year.
- gregorian_
to_ jdn - Convert a proleptic Gregorian date to a Julian Day Number.
- gregorian_
year_ days - Days in a Gregorian year (365 common, 366 leap).
- jdn_
to_ gregorian - Convert a Julian Day Number to a proleptic Gregorian date.