Skip to main content

Module date

Module date 

Source
Expand description

Calendar dates and ISO-8601 datetimes for the trust and lifecycle families (§5).

OKF v0.2 puts date-shaped fields in frontmatter and asks consumers to answer questions about them: which verification is the most recent, and is today >= stale_after. Two shapes occur:

  • ISO-8601 datetimes in generated.at and verified[].at (§5.2).
  • Plain YYYY-MM-DD dates in stale_after (§5.5), sources[].last_modified, and usage_window (§5.1).

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.