Skip to content

parse_date raises ValueError: day is out of range for month for iso8601 string #1178

@jun66j5

Description

@jun66j5
$ /venv/py311/bin/python
Python 3.11.11 (main, Dec  4 2024, 08:55:08) [GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import babel
>>> babel.__version__
'2.16.0'
>>> from datetime import datetime
>>> from babel.dates import format_date
>>> from babel.dates import parse_date
>>> parse_date('2005-12-31T01:02:03Z')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/venv/py311/lib/python3.11/site-packages/babel/dates.py", line 1252, in parse_date
    return datetime.date(year, month, day)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: day is out of range for month

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions