Closed noselasd closed 1 year ago
Patch coverage: 87.50%
and no project coverage change.
Comparison is base (
15c5ec1
) 83.43% compared to head (ab2125a
) 83.44%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@MarcoGorelli could you take a look at this one?
Nevermind, looks good!
Hello, We were trying to serialize data to Json via polars, but was hit with the missing support for DateTime types with timezone support. I'm not too well versed in Rust, but I made an attempt at adding support for it.
It's inspired by how the CSV serializer does this. The Json serializer doesn't propagate errors back in
new_serializer()
as the CSV serializer does, I havn't attempted rewriting the interface, so this panics if invalid timezones are encontered. It should still be an improvement over thetodo!("still have to implement timezone")
insrc/io/json/write/serialize.rs
DateTime
serializing is done differently from serializingNaiveDateTime
, which uses a space instead of a T as the date and time separator. However the default chronoto_string
on timezone awareDateTIme
produces a space before the tz offset (e.g. 1996-12-19 16:39:57 +08:00) which Javascript engines won't parse as a Date(), so the RFC3339 format is used instead.chrono-tz
timezones are also serialized with a fixed timezone offset format [+-hh:mm] so Javascrpt engines can make use of it.I do have some future plans as well, including adding a options for custom time format string as is done in the CSV parser, some knobs to tune how
NaiveDateTime
is serialized, but this is perhaps a start.