-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Handle ISO formats with a trailing Z #12363
Conversation
Handles the format 2020-01-22T14:24:01Z (trailing Z) | ||
which is not supported by older versions of fromisoformat. | ||
""" | ||
return datetime.datetime.fromisoformat(isodate.replace("Z", "+00:00")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! Would it make sens to mention in the comment which Python version supports the Z suffix, so we know when we can drop this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I didn't have the time to go and check, but if you want to suggest a suitable wording, I'm fine with adding it.
The reason I left things vague is that I frankly found the various discussions around the deprecation of utcnow
(here and on the cpython lists) rather confusing, and I don't feel confident enough to make any definitive statements 🙁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then I'm not going to be confident either :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chicken! 🙂
Edit: Support for Z was added in 3.11 (I think!), but I don't know whether that's the only factor here...
Close and reopen because MacOS test failed and made a bunch of other tests skip... |
Merging this on the basis that we can follow up with tests or improvements if needed. |
No description provided.