-
Notifications
You must be signed in to change notification settings - Fork 3
Description
👋 Hi there, I recently came across this nice project. As far as I know, it's the only one looking to make the aware/naive distinction at both runtime and type-checking 👏
Looking at the code though I had some questions:
1. The local timezone is cast to ZoneInfo here, but .tzinfo here always returns datetime.timezone instances.
heliclockter/src/heliclockter/__init__.py
Line 45 in 9d9443c
| tz_local = cast(ZoneInfo, _datetime.datetime.now().astimezone().tzinfo) |
I know because I've tried as well ;). timezone (e.g. CET) sadly doesn't account for variable UTC offsets (i.e. no DST), while ZoneInfo (e.g. Europe/Paris) does.
The solution could be to use the tzlocal library which helps determine the actual IANA timezone (i.e. ZoneInfo object) for the system. Pendulum uses this approach AFAIK.
2. The fold attribute is omitted from the constructor. Is this intentional? It's the only way to disambiguate times that occur twice is a timezone. It would be interesting if it could be omitted for the UTC datetime (which is never ambiguous), but required for IANA zoned datetimes.
😉 PS: I'm working on a datetime library of my own. Feel free to drop feedback if you like 🙂