Skip to content

Commit a8a1df0

Browse files
[3.12] gh-105031: Clarify datetime documentation for ISO8601 (GH-105049) (GH-114866)
(cherry picked from commit e9dab65) Co-authored-by: Nicholas Hollander <[email protected]>
1 parent 5c5ecc8 commit a8a1df0

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')
@@ -1014,8 +1022,12 @@ Other constructors, all class methods:
10141022

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

10201032
Examples::
10211033

0 commit comments

Comments
 (0)