Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for timezone without colon (similar to datetime) #537

Closed
Olegt0rr opened this issue Aug 25, 2023 · 0 comments · Fixed by #539
Closed

Add support for timezone without colon (similar to datetime) #537

Olegt0rr opened this issue Aug 25, 2023 · 0 comments · Fixed by #539

Comments

@Olegt0rr
Copy link
Contributor

Olegt0rr commented Aug 25, 2023

Description

Some APIs returns timezone without a colon symbol. Like this:

DT_STRING = "2023-08-25T20:32:38.696+0000"

It's not a problem for python's datetime:

datetime.fromisoformat(DT_STRING)
# 2023-08-25 20:32:38.696000+00:00

But it's a problem for msgspec:

class Issue(Struct):
    created_at: datetime

convert({"created_at": DT_STRING}, MyModel)
# msgspec.ValidationError: Invalid RFC3339 encoded datetime - at `$.created_at`
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 a pull request may close this issue.

1 participant