Skip to content

Calculate %U and %W without parsing a date string - #29

Merged
alphp merged 1 commit into
alphp:masterfrom
samipuro:fix/week-number-small-years
Nov 28, 2026
Merged

alphp merged 1 commit into
alphp:masterfrom
samipuro:fix/week-number-small-years

Conversation

@samipuro

Copy link
Copy Markdown
Contributor

(Found during automatic code review.)

%U and %W built a string like 999-01 Sunday, which DateTime cannot parse for years before 1000, so they threw DateMalformedStringException. They now use the day of the year and the weekday, like glibc. The results are unchanged for the years 1000 to 2100.

@alphp
alphp merged commit b1c98c3 into alphp:master Nov 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants