Skip to content

Commit 7e1df9c

Browse files
authored
fix: preserve four-digit years in ordinal date parsing
1 parent a6412f7 commit 7e1df9c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/pendulum/formatting/formatter.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,10 @@ def _check_parsed(
477477
validated["year"] = now.year
478478

479479
if parsed["day_of_year"] is not None:
480+
year = cast("int", validated["year"])
480481
dt = cast(
481482
"pendulum.DateTime",
482-
pendulum.parse(f"{validated['year']}-{parsed['day_of_year']:>03d}"),
483+
pendulum.parse(f"{year:04d}-{parsed['day_of_year']:03d}"),
483484
)
484485

485486
validated["month"] = dt.month

0 commit comments

Comments
 (0)