Skip to main content

Module gregorian

Module gregorian 

Source
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§

GregorianDate
A date in the proleptic Gregorian calendar.

Enums§

GregorianMonth
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.