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

Time zones returned are not pytz compatible #31

Open
rabinnh opened this issue Dec 9, 2019 · 3 comments
Open

Time zones returned are not pytz compatible #31

rabinnh opened this issue Dec 9, 2019 · 3 comments

Comments

@rabinnh
Copy link

rabinnh commented Dec 9, 2019

The pytz module is the standard for time zones. The time zones returned by uszipcode don't seem to be compatible "Eastern" is returned for most east coast cities, but 'US/Eastern' is correct:

from pytz import timezone
x = timezone('Eastern')
Traceback (most recent call last):
File "", line 1, in
File "/home/xxxx/.local/lib/python3.6/site-packages/pytz/init.py", line 181, in timezone
raise UnknownTimeZoneError(zone)
pytz.exceptions.UnknownTimeZoneError: 'Eastern'
x = timezone('US/Eastern')

No error with 'US/Eastern'.

@MacHu-GWU
Copy link
Owner

@rabinnh it is because the source I crawled is natively not compatible with pytz. I think I need to iterate through all timezone info and try converting to pytz. If exception catched, then handle it differently. But it is a lot of works. Will do it in next major release.

@MacHu-GWU MacHu-GWU reopened this Jun 8, 2021
@zevgriner
Copy link

Please make your change IANA-compatible based on Python 3.9 zoneinfo package.
Time zone labels do NOT contain daylight savings time information. For example, Arizona and Hawaii do not implement daylight savings time, and have separate IANA labels to infer that information.

@rabinnh
Copy link
Author

rabinnh commented Jun 10, 2021

Thanks MacHu. Love the module.

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

No branches or pull requests

3 participants