Skip to content

Commit e9dab65

Browse files
authored
gh-105031: Clarify datetime documentation for ISO8601 (GH-105049)
1 parent 6d7ad57 commit e9dab65

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')
@@ -1017,8 +1025,12 @@ Other constructors, all class methods:
10171025

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

10231035
Examples::
10241036

0 commit comments

Comments
 (0)