Record the zone designation on DateTime, so callers can read "CDT" #5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
DateTimecarries an offset and no zone designation, so there is no wayto get "CDT" out of a formatted date.
The
zandzzsequences are not the answer to this and were settledseparately in
4a1476d. moment has no zone names at all -- its wholeimplementation is
and
_isUTCis a construction mode rather than an offset of zero, somoment.parseZone("2024-03-15T09:30:00-05:00").format("z")is "UTC" too.Real abbreviations come from moment-timezone, a separate package. Those
two sequences match moment and should stay as they are; making them mean
something better would shadow a moment sequence, which is the thing that
got the superscript ordinals removed in
2720786.What is worth having is the field itself, which callers can read directly:
It should be a fixed-size array and a length rather than a slice. As a
slice it would borrow the TZif bytes, so a
DateTimecould outlive itszone and dangle, and it would stop being a self-contained value: the
tests compare
DateTimewithexpectEqualthroughout, and a slicecompares as pointer-plus-length, so two values with identical content from
different storage would compare unequal.
Six bytes is enough. Across the 1241 TZif files in tzdata 2026c there are
177 distinct designations and the longest is 5 characters (
+0430,+1345, and the rest of the numeric ones). Worth asserting on rather thantruncating silently.
TimeZone.atInstantandatTimestampwould fill it in fromTimeZone.typeAt, which already has it. Nothing else needs to change, andthe format oracle stays green because no sequence writes it.