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

get_timezone_location does not work with python's ZoneInfo object #740

Closed
youtux opened this issue Oct 9, 2020 · 1 comment · Fixed by #741
Closed

get_timezone_location does not work with python's ZoneInfo object #740

youtux opened this issue Oct 9, 2020 · 1 comment · Fixed by #741

Comments

@youtux
Copy link
Contributor

youtux commented Oct 9, 2020

get_timezone_location does not render correctly the ZoneInfo objects. These are part of python as of python 3.9 (and available as backport).

MCVE:
$ pip install backports.zoneinfo babel

# tz.py
from babel.dates import get_timezone_location
from backports import zoneinfo
import pytz

ams_native = zoneinfo.ZoneInfo("Europe/Amsterdam")
ams_pytz = pytz.timezone("Europe/Amsterdam")

print(get_timezone_location(ams_pytz))  # output: "Netherlands Time"
print(get_timezone_location(ams_native))  #  output: "Unknown Region (CEST) Time"

Python version: 3.6.11
babel version: 2.8.0

I think this can be easily fixed by checking the timezone.key attribute. Shall I make a PR?

@akx
Copy link
Member

akx commented Oct 10, 2020

Please do! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants