Module date
Expand description
Proleptic-Gregorian day counts for apps that label dates, on chrono.
Day 0 is 1970-01-01. Inputs often come straight from untrusted data (a
message header, a file name, a spreadsheet cell), so nothing here panics or
wraps: a date outside chrono’s range (about ±262,000 years) pins to the
nearest end of it.
Functions§
- civil_
from_ days - Inverse of
days_from_civil:(year, month, day)for a count of days since 1970-01-01, withmonthin 1..=12 anddayin 1..=31. - days_
from_ civil - Days since 1970-01-01 for a proleptic-Gregorian
year/month/day(month1..=12,day1..=31). Day-of-month overflow rolls forward (Feb 30isMar 2in a common year), which callers clamping withdays_in_monthnever produce. - days_
in_ month - Number of days in
month(1..=12) ofyear. A month outside 1..=12 reads as 30 rather than panicking. - weekday
- Day of the week for a count of days since 1970-01-01,
0= Sunday …6= Saturday — the indexcrate::format::weekday_abbrevtakes.