Skip to content

gh-105031: Clarify datetime documentation for ISO8601 #105049

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

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions Doc/library/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,15 @@ Other constructors, all class methods:
.. classmethod:: date.fromisoformat(date_string)

Return a :class:`date` corresponding to a *date_string* given in any valid
ISO 8601 format, except ordinal dates (e.g. ``YYYY-DDD``)::
ISO 8601 format, with the following exceptions:

1. Reduced precision dates are not currently supported (``YYYY-MM``,
``YYYY``).
2. Extended date representations are not currently supported
(``±YYYYYY-MM-DD``).
3. Ordinal dates are not currently supported (``YYYY-OOO``).

Examples::

>>> from datetime import date
>>> date.fromisoformat('2019-12-04')
Expand Down Expand Up @@ -1017,8 +1025,12 @@ Other constructors, all class methods:

1. Time zone offsets may have fractional seconds.
2. The ``T`` separator may be replaced by any single unicode character.
3. Ordinal dates are not currently supported.
4. Fractional hours and minutes are not supported.
3. Fractional hours and minutes are not supported.
4. Reduced precision dates are not currently supported (``YYYY-MM``,
``YYYY``).
5. Extended date representations are not currently supported
(``±YYYYYY-MM-DD``).
6. Ordinal dates are not currently supported (``YYYY-OOO``).

Examples::

Expand Down