Recent versions of Python have significantly improved the built-in support for timezones and timezone-aware datetimes, however I’ve not managed to find a built-in way to round-trip (or even parse, or serialize) IANA-zoned datetimes: the timezone format characters all format to a UTC offset (or in rare cases legacy timezones).
Is there anything supported, or an existing effort to add this to the stdlib? Would it make sense to propose that anywhere?
Nota: RFC 9557 extends RFC 3339 to support IANA timezones as a bracketed suffix, it also updates the meaning of the Z timezone but I’m not sure the stdlib currently generates that (zoneinfo doesn’t parse it, and the various UTC alias serialize to either UTC or some variant of the +0 offset) so this might not be a concern…
I don’t how how “problematic” this is, but in this case I’m looking to continue modernizing a planning system: the timezone handling was previously migrated from pytz to zoneinfo.
I recently read about Temporal serialization (including both offset and IANA information), which led me to RFC 9557, which seemed like it could be a useful target for both client/server communications and internal storage, and from that looking around recent changes to the stdlib to see if zoned datetimes could be read from and written to that format directly rather than formatting it “by hand”. And then asking here when I didn’t find anything.