GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
148 stars 28 forks source link

Fix bug: Zoneinfo object has no attribute localize #98

Closed Jasha10 closed 3 years ago

Jasha10 commented 3 years ago

This PR closes #94 by using the fix reported in #95.

@robgolding and other maintainers, please feel free to edit this PR by pushing commits to branch 'closes94' on my fork https://github.com/Jasha10/tasklib .

Jasha10 commented 3 years ago

https://github.com/regebro/tzlocal/issues/113 The above issue reports that in the latest version of the tzlocal library, there has been a change such that the tzlocal.get_localzone() no longer returns a pytz object -- it now returns a zoneinfo.ZoneInfo object (which is part of they Python3 standard library).

This is the cause of bug #94: the ZoneInfo object does not have a localize method. The fix suggested in the issue linked above is to use python's datetime.astimezone.