HttpDate
reads and writes HTTP-date values (RFC 9110 §5.6.7), the
timestamp form used by Date, Expires, Last-Modified, If-Modified-Since
and the Expires attribute of a Set-Cookie header.
format
(Fn [(Ref Datetime a)] String)
(format dt)
renders dt as an IMF-fixdate, e.g. Sun, 06 Nov 1994 08:49:37 GMT. It is the only format RFC 9110 §5.6.7 permits a sender to generate.
dt is converted to UTC first, so a Datetime carrying a local timezone names
the same instant once labelled GMT.
parse
(Fn [(Ref String a)] (Result Datetime String))
(parse s)
parses an HTTP-date, returning the Datetime it names in UTC.
All three formats RFC 9110 §5.6.7 obliges a recipient to accept are recognized —
IMF-fixdate (Sun, 06 Nov 1994 08:49:37 GMT), rfc850-date (Sunday, 06-Nov-94 08:49:37 GMT) and asctime-date (Sun Nov 6 08:49:37 1994) — as are two dashed
cookie-date forms RFC 6265 §5.1.1 accepts, both spelling the day name in its
abbreviated form: with a four-digit year (Thu, 01-Jan-1970 00:00:01 GMT) and
with a two-digit one (Sun, 06-Nov-94 08:49:37 GMT).
A two-digit year is windowed as 69–99 → 1969–1999 and 00–68 →
2000–2068.