Skip to content

Support > microsecond resolution in JSON timestamps - #201

Merged
jcrist merged 1 commit into
mainfrom
json-nanosecond-timestamps
Oct 10, 2022
Merged

jcrist merged 1 commit into
mainfrom
json-nanosecond-timestamps

Conversation

@jcrist

@jcrist jcrist commented Oct 10, 2022

Copy link
Copy Markdown
Member

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.

Fixes #200.

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.
@jcrist
jcrist merged commit d5b3aac into main Oct 10, 2022
@jcrist
jcrist deleted the json-nanosecond-timestamps branch October 10, 2022 16:20
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.

Feature request: Ignore nanoseconds in datetime strings

1 participant