top | item 42810626

(no title)

mattdw | 1 year ago

For sure, but for future events to be correct I still have to store that as (plain datetime, pacific/auckland), not translated to utc at the point of creation/saving. If I store only a UTC datetime I have unrecoverable lost important information.

discuss

order

burntsushi|1 year ago

That's exactly why Temporal uses RFC 9557 for its `ZonedDateTime` serialization format:

    >> zdt = Temporal.Now.zonedDateTimeISO()
    >> zdt.toJSON()
    "2025-01-24T19:57:01.089557834-05:00[America/New_York]"
    >> zdt.toString()
    "2025-01-24T19:57:01.089557834-05:00[America/New_York]"
Temporal will even check that the offset is still correct for the time zone when you deserialize.