Timestamp, or Nullable.init on any violation.Parses a timestamp from YYYY-MM-DD[T ]HH:MM:SS[.f{1,9}][Z|±HH:MM].
Every field is range-checked (month 1..12, day 1..days-in-month with the leap rule, hour 0..23, minute 0..59, second 0..59, offset hours 0..23 and minutes 0..59); a missing offset means UTC, never local time; trailing garbage is rejected.
Why not Phobos' parsers? SysTime.fromISOExtString and kin exist and UTC() as the second argument fixes the local-time assumption for offset-less strings, but their parse targets cannot carry the value exactly: SysTime stores hectonanoseconds, so a nine-digit fraction silently truncates to seven digits - a corruption for a type whose contract is nanosecond-exact tick arithmetic without lossy intermediates. Recovering the last two digits means hand-scanning the fraction anyway. Additionally TimeOfDay has no fromISOExtString (the TIME grammar would need a dummy-date dance), and this scanner's total, allocation-light shape returns Nullable for the failure-as-value conventions of ddn.df's casts and CSV reading.
text | the text to parse |
Timestamp, or Nullable.init on any violation.