Skip to content

Document implicit UTC vs ZonedDateTime serialization #303 - #390

Merged
cowtowncoder merged 2 commits into
FasterXML:2.xfrom
AzazelSensei:docs-zoneddatetime-implicit-utc-303
Sep 21, 2026
Merged

cowtowncoder merged 2 commits into
FasterXML:2.xfrom
AzazelSensei:docs-zoneddatetime-implicit-utc-303

Conversation

@AzazelSensei

Copy link
Copy Markdown
Contributor

ObjectMapper documents UTC as the default TimeZone, but that value stays implicit until setTimeZone is called. ZonedDateTime therefore keeps its own zone when written as ISO-8601 unless WRITE_DATES_WITH_CONTEXT_TIME_ZONE has an explicit timezone.

I documented that in the datetime README, JavaTimeModule, and InstantSerializerBase. Behavior is unchanged.

Fixes #303

ObjectMapper default TimeZone is UTC but hasExplicitTimeZone() stays
false until setTimeZone is called, so ZonedDateTime keeps its own zone
unless WRITE_DATES_WITH_CONTEXT_TIME_ZONE has an explicit timezone.
@cowtowncoder
cowtowncoder merged commit 95d2227 into FasterXML:2.x Sep 21, 2026
@cowtowncoder

Copy link
Copy Markdown
Member

Thank you @AzazelSensei !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZonedDateTime not serialised as UTC by default altough ObjectMapper Javadocs claiming UTC is the default

2 participants