Skip to main content

Module datetime

Module datetime 

Source
Expand description

XSD date/time/duration parsers.

XSD §3.2.6–3.2.13 — eight calendar types plus xs:duration. All use an ISO-8601 subset; XSD diverges from full ISO-8601 in a few ways (no week dates, year zero forbidden, leap-second support).

Timezone:

  • Optional on every type.
  • Z means UTC (offset 0).
  • +HH:MM / -HH:MM ranges from -14:00 to +14:00.

Comparison of two values without timezones is partial — they’re treated as distinct points in the implicit local timezone and compare equal only on exact field match. Comparisons with at least one timezone-bearing operand normalise to UTC.

Structs§

XsdDate
XsdDateTime
XsdDuration
xs:duration — split into a months part (years×12 + months) and a seconds part (days×86400 + h×3600 + m×60 + s). This split is forced by the spec: months cannot be reduced to seconds without a reference date. Two durations compare equal only when both parts match.
XsdGDay
XsdGMonth
XsdGMonthDay
XsdGYear
XsdGYearMonth
XsdTime

Functions§

parse_date
parse_date_time
parse_duration
parse_g_day
parse_g_month
parse_g_month_day
parse_g_year
parse_g_year_month
parse_time