Repository navigation
Commit 2bebbf1
committed
Fix ISO 8601 week dates with years < 1000
_get_iso_8601_week built the intermediate string as
f"{year}-{ordinal}" without zero-padding, but strptime's %Y matches
exactly four digits, so every week date in a year below 1000
(0999-W34-6, 0416W346, 0004-W10-5, ...) failed with a generic
ParserError while datetime.fromisoformat accepts them and the same
years parse fine in calendar form.
Pad the year to 4 digits.
Fixes #1076
Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>1 parent e06dace commit 2bebbf1
2 files changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
| |||
0 commit comments