Skip to main content

Module dates

Module dates 

Source
Expand description

VAPP-190: calendar-day maths, the Rust twin of packages/exponential-ui/src/dates.ts, shared by the records query (time buckets, host::query) and the bind-time expressions (Q2: dateAdd, startOf, isoWeek…). Pure and proleptic Gregorian over YYYY-MM-DD texts, no clock and no locale; fixtures/records-query.json bucketCases lock it. A date is a calendar day (spec §4.3); a timestamp’s day is the first ten characters of its ISO text.

Structs§

CalendarDay

Enums§

DateBucket
The time buckets a query groups dates by.

Constants§

DATE_BUCKETS

Functions§

date_bucket
A date’s bucket key: day 2026-10-05, week 2026-W41 (ISO), month 2026-10, quarter 2026-Q4, year 2026; None when the text holds no date that precise.
day_from_number
day_number
VAPP-191: the days since 1970-01-01 of a calendar day (negative before; Howard Hinnant’s days_from_civil), and back (dayNumber / dayFromNumber in dates.ts).
day_of_year
1-based day of the year.
days_in_month
format_day
YYYY-MM-DD.
is_leap_year
iso_week
The ISO week (Monday first, week 1 holds the first Thursday): (year, week).
iso_weeks_in_year
ISO 8601 weeks in a year: 53 when it starts on a Thursday (or a Wednesday in a leap year).
parse_day
The calendar day at the start of text (YYYY-MM-DD, then the end, T or a space); None when it is not a real day.
parse_month
The year and month at the start of text (YYYY-MM, then the end or -).
parse_year
The year at the start of text (YYYY, then the end or -).
weekday_of
0 = Sunday (Sakamoto’s method).