Bugfix datetime serialization utc zero offset #1016
Merged
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.
Proposed Changes:
For inclusion in changelog (if applicable):
Not intended for changelog:
Diff of User Interface
Old behavior:
passing a timezone aware datetime from the UTC zone to some of the request constructors resulted in malformed datetime strings, e.g:
2022-06-01T01:00:00+00:00Z
- i.e. strings that have BOTH+00:00
andZ
at the end.At the root of it was
value.utcoffset()
>>timedelta(hours=0)
evaluating as False even though there is a defined offset here:New behavior:
The Z is tagged on only if the utcoffset() is None.
When the TZ is UTC the dt string is:
2022-06-01T01:00:00+00:00
The previous test setup for timezone aware datetimes obfuscated this bug, so I changed the tests as well.
PR Checklist:
(Optional) @mentions for Notifications: