Open tisonkun opened 3 days ago
I think we should do this, but I think what you're doing in that sqlx PR is not quite right. You're using strptime
in the first place because parsing a Zoned
requires the time zone annotation. But if you parse into a Timestamp
without strptime
at all, then it will work just fine. And a Timestamp
more accurately models what PostgreSQL is giving you. You generally should only use a Zoned
when you have a time zone.
I think I'd prefer not adding more format specifiers for this, and instead just make the existing %z
and %:z
specifiers parse successfully when minutes aren't present. I guess the downside there is that you might specifically want there to be four digits if you're trying to match an existing format. Or when you're printing. So maybe we can't do that and we do indeed need additional specifiers. Sigh. But this will also apply to %V
too.
chrono
supports:in
strptime
- https://docs.rs/chrono/latest/chrono/format/strftime/index.html.jiff's
%#z
is identical to%z
that accepts only[+-]HHMM[SS]
.Is it possible to add similar support? The format seems what PostgreSQL's timestamptz uses and now blocks https://github.com/launchbadge/sqlx/pull/3511.