Week number is one too high in southern-hemisphere DST zones for years starting on Friday
Author: ManoharPaturiCreated Sep 18, 2026Updated Sep 18, 2026
what happens
plainDateGetWeekNumber mixes local-time Date math with day-count division, so a DST offset leaks into the result. in timezones where DST ends after new year (Sydney, Auckland, Santiago), every year starting on a friday (2021, 2027) reports the week number one too high for most of the year.
Calendar's hasWeekNumbers column and the exported getWeekNumber both show it. counting with Sydney's 2020-2030, 364 dates are wrong.
repro (node, TZ=Australia/Sydney)
the repo's implementation vs a pure-UTC ISO reference for 2021-04-07:
- iso week: 14
- repo: 15
same +1 error through the year (2021-04-14 → 16 vs 15).
expected
pure calendar math with no wall-clock offset leaking in (UTC anchors), matching ISO 8601.
env: main 5a7b819
Source: facebook/astryx