Skip to content

Fix dateutil timezone ID detection on Windows - #2143

Open
yash-yeole wants to merge 3 commits into
PyCalendar:mainfrom
yash-yeole:fix-dateutil-timezone-id-windows
Open

yash-yeole wants to merge 3 commits into
PyCalendar:mainfrom
yash-yeole:fix-dateutil-timezone-id-windows

Conversation

@yash-yeole

Copy link
Copy Markdown

Description

Fixes an issue where tzids_from_tzinfo() fails to identify dateutil timezone IDs on Windows.

In some environments, dateutil timezone objects expose a relative IANA timezone filename (for example, Pacific/Fiji), while DATEUTIL_ZONEINFO_PATH and DATEUTIL_UTC_PATH are unavailable. The existing implementation relies on the zoneinfo root path to identify these filenames, causing timezone identification to return an empty tuple.

This change:

  • Handles relative timezone filenames directly.
  • Validates identified timezone IDs against zoneinfo.available_timezones().
  • Improves handling of absolute filenames when the zoneinfo root path is unavailable.
  • Adds regression tests for timezone aliases, absolute filenames, and unrecognized filenames.
  • Updates an existing test to account for dateutil resolving timezone aliases to canonical IDs.

Testing

  • python -m pytest -q src/icalendar/tests/test_timezone_identification.py — 1812 passed.
  • python -m pytest -q src/icalendar/tests/test_issue_722_generate_vtimezone.py — 788 passed, 13 skipped.

AI Usage

Claude Sonnet 5.5 was used to investigate dateutil behavior and assist with implementation and regression tests.
ChatGPT GPT-6 was used to review the implementation, investigate platform-specific behavior, and validate the changes.

Closes #2142

Copilot AI balanced review requested due to automatic review settings November 17, 2026 17:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @yash-yeole! A maintainer will review it shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Insufficient data

Not enough activity yet to make a reliable assessment.

View full analysis →

This is an automated analysis by AgentScan

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by a platform-dependent regression test and an uncached timezone filesystem scan that can cause repeated performance overhead during serialization.

2 open issues

Review effort: Lite

Comment thread src/icalendar/timezone/tzid.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The change affects Windows-specific dateutil filename and zoneinfo behavior that cannot be exercised in this environment, so human validation of the relevant path scenarios is still needed.

No open issues 🎉

2 resolved since last review

Review effort: Lite

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] dateutil timezone IDs are not detected on Windows

2 participants