Skip to content

Deserialize iso8601 to OffsetDateTime with offset being optional #582

Closed Answered by jhpratt
ogarcia asked this question in Question
Discussion options

You must be logged in to vote

The error is correct, as an explicit UTC offset must be provided. NaiveDateTime in chrono is equivalent to PrimitiveDateTime in time. UTC is not assumed, as a PrimitiveDateTime does not have a concept of UTC offsets. OffsetDateTime does, but does not have a default offset. While the specification does seem to indicate (it's not 100% clear) that it should fall back to the local offset, this is highly error prone in practice, not to mention the fact that it would fail in multi-threaded environments on some systems.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@ogarcia
Comment options

@jhpratt
Comment options

@RReverser
Comment options

Answer selected by ogarcia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants