tzlocal icon indicating copy to clipboard operation
tzlocal copied to clipboard

returned datetime.timezone when api states it returns ZoneInfo objects

Open alejcas opened this issue 8 months ago • 0 comments

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

alejcas avatar May 30 '24 13:05 alejcas