Skip to content

bpo-37962: Improve ISO 8601 timezone support in the datetime.fromisoformat() method (GH-15547)#15547

Closed
zeth wants to merge 5 commits into
python:masterfrom
zeth:improve_iso8601_timezone_support
Closed

bpo-37962: Improve ISO 8601 timezone support in the datetime.fromisoformat() method (GH-15547)#15547
zeth wants to merge 5 commits into
python:masterfrom
zeth:improve_iso8601_timezone_support

Conversation

@zeth

@zeth zeth commented Aug 27, 2019

Copy link
Copy Markdown
Contributor

Makes the datetime.fromisoformat() method more conformant with ISO 8601.

Namely, section 4.2.5.1: "When it is required to indicate the difference between local time and UTC of day, the representation of the difference can be expressed in hours and minutes, or hours only."

And Section 4.2.4, UTC shall be expressed "by the UTC designator [Z]".

A key use case of the latter is being able to parse JavaScript Date objects (e.g. dates that have come from a web frontend or a JSON document). This considerably improves the usefulness of the datetime.fromisoformat method.

https://bugs.python.org/issue37962

@zeth zeth requested review from abalkin and pganssle as code owners August 27, 2019 12:03
@zeth zeth changed the title bpo-NNNN: Improve ISO 8601 timezone support in the datetime.fromisoformat() method (GH-NNNNN) bpo-37962: Improve ISO 8601 timezone support in the datetime.fromisoformat() method (GH-15547) Aug 27, 2019
@pganssle

Copy link
Copy Markdown
Member

Per the discussion on the discourse and elsewhere, I think we are going to decline this particular PR in favor of a more full-featured ISO 8601 parsing, hopefully before Python 3.9.

Thank you for your contribution @zeth, it is much appreciated, please do not let this discourage you from making future PRs.

@pganssle pganssle closed this Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants