You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parser.isoparse() accepts invalid ISO 8601 timestamps #1341
Here are an example that accepts 6 timestamp string that are all invalid according to ISO 8601:
from dateutil.parser import isoparse
for i in (
"2024-01-17T15:21:00-0800",
"2024-01-17T152100-08:00",
"20240117T15:21:00-08:00",
"2024-01-17T152100-0800",
"20240117T15:21:00-0800",
"20240117T152100-08:00"):
print(isoparse(i))
The EBNF grammar in ISO 8601 clearly indicates that basic format (date without dashes, time and zone without colons) cannot be mixed with the extended format (date with dashes, time and zone with colons). Yet, any mixture of basic and extended format is accepted by isoparse().
It should be said that only removing a single dash from the date or a single colon from the time is not accepted by isoparse().
Activity
Paebbels commentedon Feb 23, 2024
The same bug has been reported to Python's stdlib: