gweis / isodate

ISO 8601 date/time parser
BSD 3-Clause "New" or "Revised" License
155 stars 59 forks source link

ValueError: second must be in 0..59 in parse_datetime #90

Open zeisss opened 3 months ago

zeisss commented 3 months ago

Similar to #87: parse_datetime() raises an error if the seconds and milliseconds are above 59.5:

>>> from isodate import parse_datetime
>>> parse_datetime("2024-07-27T19:58:59.999999571Z")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "my-project/.venv/lib/python3.11/site-packages/isodate/isodatetime.py", line 56, in parse_datetime
    tmptime = parse_time(timestring)
              ^^^^^^^^^^^^^^^^^^^^^^
  File "my-project/.venv/lib/python3.11/site-packages/isodate/isotime.py", line 131, in parse_time
    return time(int(groups['hour']), int(groups['minute']),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: second must be in 0..59