Skip to main content

Module date

Module date 

Source
Expand description

Calendar dates and ISO-8601 datetimes for the trust and lifecycle families.

OKF v0.2 puts timestamp fields in frontmatter and asks consumers to answer questions about them: which verification is the most recent, and is now >= stale_after.

Every timestamp-valued key in OKF frontmatter is an ISO-8601 datetime with an explicit UTC offset (e.g. 2026-06-30T14:00:00Z), across generated.at, verified[].at, stale_after, sources[].last_modified, and usage_window. Plain YYYY-MM-DD dates are used only in log.md section headings.

Answering those needs real date arithmetic, so this module implements the small amount required on the standard library alone: a proleptic Gregorian Date, an offset-aware DateTime that orders correctly across time zones, and the DateField / DateTimeField wrappers that keep the raw scalar around so a validator can report what failed to parse.

Structsยง

Date
A proleptic-Gregorian calendar date (YYYY-MM-DD).
DateField
A frontmatter date field: the scalar exactly as written, plus its parse.
DateTime
An ISO-8601 datetime: a Date, an optional time of day, and an optional UTC offset.
DateTimeField
A frontmatter datetime field: the scalar exactly as written, plus its parse.
ParseDateError
Error returned when a string is not a valid date or datetime.