Dates, times and timezones for Zig 0.17: IANA tzdata, ISO 8601, RFC 822, strftime, CLDR, Go, .NET and git date formats

finish the format side of moment.js compatibility

Everything moment.js can format, this can now format the same way, bar the zone name. 777266 comparisons, no divergence. Literals stop being a whitelist. Anything that is not a sequence is copied through, which is how moment behaves and which makes `YYYY/MM/DD` work where it used to be a compile error. Square brackets make a literal of what would otherwise be read as a sequence, and a backslash does the same for whatever follows it. The corners are moment's and are followed rather than tidied, because a format string that means one thing there and another here is the whole problem. A `[` with no `]` after it is a literal bracket; so is one that would have to nest, which is why `[a[b]` is a bracket, then `a`, then a bracketed `b`. A backslash before another backslash yields nothing at all, and so does a trailing one, because moment strips every backslash out of the run its regex matched. All of it is in the corpus. Token, which used to be a character or a tag, is now a run of characters or a tag: bracketed text arrives at once, and an escape can produce nothing. New sequences: Y, YYYYY and YYYYYY; y, yo, yy, yyy and yyyy; N through NNNNN; ggggg and GGGGG; X and x; and Hmm, Hmmss, hmm and hmmss, which are single sequences rather than an hour beside a minute and so are not the same as writing the parts. YYY stops being a sequence, because moment reads it as YY followed by Y, and it now does too. The localized sequences -- L, LL, LLL, LLLL, LT, LTS and the four lower case ones -- stand for a whole format string rather than for a value, so they are expanded into what they stand for before anything is tokenized, which is moment's arrangement. The expansions are the `en` locale's, the only locale there is here. X and x needed a DateTime to name an instant, so toInstant is added: the inverse of Instant.asDateTime, and simpler than TimeZone.resolve because a reading with an offset on it cannot be ambiguous or missing. Still absent: z and zz, the zone abbreviation. A DateTime carries an offset and no designation, so there is nothing to write; it needs either a field or formatting through a TimeZone, and that is a data model question rather than a formatting one. Parsing is unchanged. zig build test 202 pass, 4 skip zig build test -Dno-system-tzdata 180 pass, 26 skip zig build test -Dembed-tzdata 206 pass Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TFydFscsLXY7WWaGL4NKnL


Author jcollie.dev
Co-author Claude Opus 5 (1M context) Date Commit Parent 2720786e
+440 -71
3 changed files
+440 -71
3 changed files