MacHu-GWU / uszipcode-project

USA zipcode programmable database, includes up-to-date census and geometry information.
MIT License
231 stars 49 forks source link

Time zones returned are not pytz compatible #31

Open rabinnh opened 4 years ago

rabinnh commented 4 years ago

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 commented 3 years ago

@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.

zevgriner commented 3 years ago

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 commented 3 years ago

Thanks MacHu. Love the module.