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
parse() rejects ISO 8601 week dates with years < 1000 (strptime %Y needs zero-padding) #1076
pendulum.parse() rejects valid ISO 8601 week dates whose year is below 1000, even though the same years parse fine as ordinary calendar dates, and datetime.fromisoformat() accepts them:
The year is interpolated without zero-padding, so for year 416 the string is "416-240". strptime's %Y matches exactly four digits, so the lookup fails with ValueError: time data '416-240' does not match format '%Y-%j', which _parse then masks into the generic ParserError("Unable to parse string [...]").
The boundary is exact: years ≥ 1000 work, years ≤ 999 fail.
Expected behavior
Zero-pad the year (f"{year:04d}"), matching what the %Y directive requires. 0416-W34-6 then parses to 0416-08-27, same as datetime.fromisoformat.
Activity