Support > microsecond resolution in JSON timestamps - #201
Merged
Merged
Conversation
Previously the JSON decoder would error if a `datetime` string was encountered with > microsecond resolution. Since Python datetimes (and many systems) only support microsecond resolution, this limitation was deemed fine until someone asked for support. That's now happened :). We now support datetime strings with infinite precision, rounding to the nearest microsecond. This means that these timestamps won't roundtrip accurately through msgspec if parsed into python `datetime` objects, but there's not much we can do to work around that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the JSON decoder would error if a
datetimestring was encountered with > microsecond resolution. Since Python datetimes (and many systems) only support microsecond resolution, this limitation was deemed fine until someone asked for support. That's now happened :).We now support datetime strings with infinite precision, rounding to the nearest microsecond. This means that these timestamps won't roundtrip accurately through msgspec if parsed into python
datetimeobjects, but there's not much we can do to work around that.Fixes #200.