Expand description
Date and time conversion helpers.
Mirrors the logic in Go date.go, converting between Excel serial numbers
and chrono naive date/time types while accounting for the 1900/1904 date
system and the Excel 1900 leap-year bug.
Structs§
- Date
- Convenience helper for date/time conversions used elsewhere in the crate.
Constants§
- EXCEL_
BUGGY_ PERIOD_ START - Start of the period affected by the Excel 1900 leap-year bug (1900-03-01).
- EXCEL_
EPOCH_ 1900 - Forward-conversion epoch for the 1900 date system (1899-12-31).
- EXCEL_
EPOCH_ 1904 - Excel epoch for the 1904 date system (1904-01-01).
- EXCEL_
MIN_ TIME_ 1900 - Earliest representable date in the 1900 date system.
- EXCEL_
REVERSE_ EPOCH_ 1900 - Reverse-conversion epoch for the 1900 date system (1899-12-30).
Functions§
- date_
to_ excel_ serial - Convert a
NaiveDateto an Excel serial number. - datetime_
to_ excel_ serial - Convert a
NaiveDateTimeto an Excel serial number. - excel_
serial_ to_ datetime - Convert an Excel serial number to a
NaiveDateTime. - format_
year - Convert a 2-digit year into a 4-digit year using Excel’s 30/1900 rule.
- get_
days_ in_ month - Return the number of days in the given month.
- is_
leap_ year - Determine whether a year is a leap year.
- time_
to_ excel_ serial - Convert a
NaiveTimeto the fractional part of an Excel day. - validate_
date - Validate whether the given year, month and day form a legal date.