Skip to content

fix(tz): map the Windows zones CLDR already names - #1059

Open
Cherith1222 wants to merge 2 commits into
python-pendulum:masterfrom
Cherith1222:fix/1058-windows-canada-zones
Open

Cherith1222 wants to merge 2 commits into
python-pendulum:masterfrom
Cherith1222:fix/1058-windows-canada-zones

Conversation

@Cherith1222

Copy link
Copy Markdown

Why

On Windows, pendulum.now() looks up TimeZoneKeyName in a fixed table and raises LookupError when the name is missing. CLDR's territory 001 rows already name seven of those zones, including the Canada zones Windows added in October 2026. Two older rows also point at zones that no longer share the Windows offset.

What changed

  • Add British Columbia, Alberta, Manitoba, Yukon, Qyzylorda, South Sudan, and Volgograd.
  • Point Central Asia Standard Time at Asia/Bishkek, and Mountain Standard Time (Mexico) at America/Mazatlan.

Scope

  • Covers the Windows name table used for the local timezone.
  • Leaves the Europe/Kyiv and Etc/GMT spellings as they are.
  • Does not raise the tzdata requirement. Winnipeg's offset after 1 November 2026 still depends on a current tzdata.

Tradeoffs

Keeping Asia/Almaty and America/Chihuahua would preserve offsets that are an hour away from the Windows zone. This table already follows CLDR's territory 001 row for the other names.

Blast Radius

pendulum.now() on Windows reads this table. Machines on the new Canada zones stop raising. Machines on Central Asia Standard Time or Mountain Standard Time (Mexico) follow the CLDR zone.

Verification

  • Before the table change, the nine new mapping cases failed. Seven were KeyError. Central Asia was Asia/Almaty, and Mountain Standard Time (Mexico) was America/Chihuahua.
  • After the change, py -3.13 -m pytest tests/tz/test_local_timezone.py -q reported 11 passed and 3 skipped. The skipped tests are the Unix-only cases.
  • On this Windows machine the registry lookup still returns Asia/Taipei.

Fixes #1058

Drafted with Cursor.

This branch has not been deployed

No deployments
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.

pendulum.now() raises LookupError on Windows' new Canada time zones

1 participant