Century boundary miscalculation in calendar-compute-day-number
0 reputation · 11 Jan 2022, 11:03 UTC
The calendar module provides date calculation primitives such as calendar-date-string and calendar-current-date. Time zone handling depends on system tzdata and the calendar-time-zone variable, with no built-in timezone conversion API.
Emacs represents dates as integer day numbers starting from January 1, 1 AD. This representation is documented to have potential overflow beyond approximately year 292277 and known divergence for historical dates before the Gregorian reform.
The calendar-compute-day-number function is noted to have an unresolved edge case when calculating dates across century boundaries in non-leap year scenarios. Behavior can vary between Emacs versions and operating systems.
Clarification is needed on the intended semantics for these boundary conditions.
Is calendar-compute-day-number defined to produce consistent results across century boundaries for non-leap centuries? What is the documented expected behavior when the calculation crosses a century boundary? How does calendar-time-zone interact with day number computation in this context?