Skip to content

Commit 3acab9a

Browse files
[3.11] gh-105031: Clarify datetime documentation for ISO8601 (GH-105049) (GH-114867)
(cherry picked from commit e9dab65) Co-authored-by: Nicholas Hollander <[email protected]>
1 parent e3458aa commit 3acab9a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Doc/library/datetime.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,15 @@ Other constructors, all class methods:
536536
.. classmethod:: date.fromisoformat(date_string)
537537

538538
Return a :class:`date` corresponding to a *date_string* given in any valid
539-
ISO 8601 format, except ordinal dates (e.g. ``YYYY-DDD``)::
539+
ISO 8601 format, with the following exceptions:
540+
541+
1. Reduced precision dates are not currently supported (``YYYY-MM``,
542+
``YYYY``).
543+
2. Extended date representations are not currently supported
544+
(``±YYYYYY-MM-DD``).
545+
3. Ordinal dates are not currently supported (``YYYY-OOO``).
546+
547+
Examples::
540548

541549
>>> from datetime import date
542550
>>> date.fromisoformat('2019-12-04')
@@ -1006,8 +1014,12 @@ Other constructors, all class methods:
10061014

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

10121024
Examples::
10131025

0 commit comments

Comments
 (0)