Expand description
Dates and times without a date crate.
spar needs a moment in four shapes: a file stamp that sorts, a header line
a person reads, the RFC 3339 form GitHub returns so a recorded time compares
with a comment’s created_at as a string, and the HTTP date form a
conditional request sends back. The days to civil arithmetic is Howard
Hinnant’s, valid for any date this will ever see.
Functions§
- date_
line 2026-09-12 14:03 UTC, for the header a person reads.- file_
stamp yyyymmdd-hhmmssin UTC, for a file name that sorts by when it was made.- http_
date Tue, 20 Oct 2026 10:00:00 GMT, the shape aLast-Modifiedheader takes and anIf-Modified-Sinceheader sends back.- now_
secs - parse_
rfc3339 2026-10-20T18:04:05Zback to seconds. A fractional second is accepted and dropped; anything else that is not that shape, or is before 1970, is None.- rfc3339
2026-10-20T18:04:05Z, the shape GitHub returns, so a time spar recorded and a time GitHub reports compare as strings.