Retain original offset or normalize to UTC for xs:dateTime values?
0 reputation · 04 Jun 2022, 21:21 UTC
The goal is to determine whether an XML serializer should preserve the original timezone offset embedded in an xs:dateTime value or convert the instant to UTC and serialize it with the ‘Z’ designator. Preserving the offset keeps the source civil time but can produce multiple lexical representations for the same instant when a region observes daylight‑saving time, complicating equality checks and indexing. Converting to UTC simplifies comparison and storage, yet discards the original zone information, requiring external metadata if the local time must be displayed later. Different XML binding frameworks (JAXB, .NET XmlSerializer, lxml) currently adopt opposite defaults, creating interoperability gaps when documents are exchanged across systems.
Which approach provides reliable round‑trip behavior across JAXB, .NET XmlSerializer, and lxml without requiring application‑specific zone data? How should a serializer handle timestamps that fall inside a DST transition when the original offset is retained? What minimal metadata, if any, should be added to a UTC‑normalized xs:dateTime to allow reconstruction of the original civil time?