Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pendulum.tz.timezones() to use system tzdata #801

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/pendulum/tz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from importlib import resources
from pathlib import Path
from typing import cast
from zoneinfo import available_timezones

from pendulum.tz.local_timezone import get_local_timezone
from pendulum.tz.local_timezone import set_local_timezone
Expand All @@ -22,13 +23,7 @@


def timezones() -> tuple[str, ...]:
global _timezones

if _timezones is None:
with cast(Path, resources.files("tzdata").joinpath("zones")).open() as f:
_timezones = tuple(tz.strip() for tz in f.readlines())

return _timezones
return available_timezones()


def fixed_timezone(offset: int) -> FixedTimezone:
Expand Down
Loading