regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
185 stars 58 forks source link

returned datetime.timezone when api states it returns ZoneInfo objects #161

Open alejcas opened 4 months ago

alejcas commented 4 months ago

Hi,

On O365 we use tzlocal to get a default timezone for our users.

One of our users has reported an issue https://github.com/O365/python-o365/issues/1077.

It seems that on his system tzlocal is unable to find the system timezone and then returned UTC.

The problem we have is that the returned type for this "UTC" is datetime.timezone which is a tzinfo object and not a ZoneInfo object

As stated by the tzlocal readme:

Version 5.0 removes the pytz_deprecation_shim, and now only returns zoneinfo objects,

We depend on the tzlocal returning ZoneInfo objects because we need to use the "key" attribute to translate IANA to WINDOWS timezones.

¿Can you please see why is tzlocal returning datetime.timezone and not ZoneInfo objects in this particular case?

Thanks