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

Python datetime serialisation/deserialisation not working correctly without timezone #71

Open
cimpeanvasile opened this issue Mar 24, 2023 · 0 comments · May be fixed by #72
Open

Python datetime serialisation/deserialisation not working correctly without timezone #71

cimpeanvasile opened this issue Mar 24, 2023 · 0 comments · May be fixed by #72

Comments

@cimpeanvasile
Copy link

There seems to be an issue with serialising and deserialising datetimes for python generated dataclasses.
This example fails with ValueError: ('Invalid RFC3339 date/time', '2023-01-01T00:00:00'):

some_dataclass = SomeDataclass(some_time=datetime(2023, 1, 1, 0, 0, 0))
json_data = some_dataclass.to_json_data()
some_dataclass = SomeDataclass.from_json_data(json_data)

It seems to be because the serialising to json for datetime is just datetime.isoformat(), which will return '2023-01-01T00:00:00' for the mentioned value. This will then fail the check in the generated dataclass' _parse_rfc3339 function.

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