97jaz / gregor

Date and time library for Racket
45 stars 10 forks source link

LDML "ZZZZZ" doesn't support "Z" #58

Open kengruven opened 6 months ago

kengruven commented 6 months ago

(Maybe this is nit-picking, but I ran into it yesterday and it frustrated me for a while.)

In the TR35 Date Field Symbol Table, "Z" with No=5 is described as:

The ISO8601 extended format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. This is equivalent to the "XXXXX" specifier.

Elsewhere in this document, in the examples after the sentence "For ISO 8601 time zone format return the results according to the ISO 8601 specification.", it has:

supporting the idea that "ZZZZZ" should support Z.

In gregor, though, it does not:

(~t (moment 2001 2 3 4 5 6 #:tz 0) "XXXXX")
;; =>
"Z"

(~t (moment 2001 2 3 4 5 6 #:tz 0) "ZZZZZ")
;; =>
"+00:00"

I tried to find another implementation of TR35 to confirm, and ran across NSDateFormatter.com. Both "XXXXX" and "ZZZZZ" here generate the output "Z", while "xxxxx" generates "+00:00", as expected.