Expand description
The datetime string format.
atproto’s datetime is a subset of both RFC 3339 and ISO 8601, and the
interesting part is everything the subset excludes. Every field is
zero-padded to a fixed width, the T separator and the Z designator are
uppercase only, seconds are mandatory, a timezone is mandatory, and
-00:00 — RFC 3339’s “offset unknown” — is refused because ISO 8601 does
not have it. The result is a format where two timestamps naming the same
instant are the same string far more often than RFC 3339 would give.
Syntax is not the whole check. 1985-13-12T23:20:50.123Z is well formed
and names month thirteen, so the calendar is validated too: upstream keeps
those cases in a separate datetime_parse_invalid.txt precisely because an
implementation that only matches the shape looks green while accepting
them.
Enums§
- Datetime
Error - Why a string is not a valid atproto datetime.
Functions§
- days_
before_ 🔒month - Days elapsed in the year before the first of
month. - days_
in_ 🔒month - How many days that month holds in that year.
- is_leap 🔒
- Whether a year is a leap year in the proleptic Gregorian calendar.
- range 🔒
- Bounds one component, naming it in the error.
- render
- Writes
atin this format: RFC 3339, in UTC, with theZdesignator. - validate
- Checks a string against the atproto datetime rules, syntax and calendar.