Skip to content
Merged
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
7 changes: 5 additions & 2 deletions pydantic_extra_types/timezone_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ def _warn_about_pytz_usage() -> None:

def get_timezones() -> set[str]:
"""Determine the timezone provider and return available timezones."""
if _is_available('zoneinfo') and _is_available('tzdata'): # pragma: no cover
return _tz_provider_from_zone_info()
if _is_available('zoneinfo'): # pragma: no cover
timezones = _tz_provider_from_zone_info()
if len(timezones) == 0: # pragma: no cover
raise ImportError('No timezone provider found. Please install tzdata with "pip install tzdata"')
return timezones
elif _is_available('pytz'): # pragma: no cover
return _tz_provider_from_pytz()
else: # pragma: no cover
Expand Down