Skip to main content

Module date

Module date 

Source
Expand description

Calendar arithmetic for the date picker, ported from upstream’s datepicker.ts.

Dates are civil dates with no time zone, so no daylight-saving shift can turn midnight into the previous day; they cross the API as ISO YYYY-MM-DD. Day counts use Howard Hinnant’s days_from_civil, exact over the whole proleptic Gregorian range this type allows.

Structs§

Date
A calendar date. Construction validates it, so every Date exists.
InvalidDate
The text or numbers do not name a real date.

Functions§

days_in_month
Days in a month of a year.
key_target
Where a key moves focus from current, as upstream’s date grid does: arrows by a day (swapped in RTL) or a week, Home and End to the ends of the week, Page Up and Down by a month, or a year with Shift.
leading_blanks
How many blank cells come before the first of the month, given the first day of the week (0 = Sunday).