Functional Weave
Code in Rust

dates.is-leap-year@1.0.0

README.md

816 bytes · view raw

# dates.is-leap-year

True when February of the year has 29 days. The rule is the full Gregorian
one: divisible by 4, except century years, except those divisible by 400. So
2024 and 2000 were leap years and 1900 was not, and 2100 will not be. Code that
tests only `year % 4` gets 1900 and 2100 wrong, and 1900 is still inside real
data (pension and land records).

The rule itself lives in dates.add-days, the calendar kernel every dates
capability shares; this package is the searchable, validated front door to it,
so nobody re-types the rule.

The year must be a whole number from 1 to 9999, the range the rest of the
dates family supports. The Gregorian calendar is applied proleptically: years
before 1582 (1752 in Britain) are answered by the Gregorian rule, not the Julian
one that was actually in use then.