Re:Pytz: The Fastest Footgun in the West
by zzzeek on Friday May 12, 2023 @11:33AM
(#35917660)
I was going to complain that Python for all of its "batteries included" lacks a simple facility in the standard library to "please give me a timezone for EDT", but apparently one has been added in 3.9: https://docs.python.org/3/library/zoneinfo.html#module-zonei...
[ Parent
| on HN ]
The real problem that still is not fixed is that `datetime.date.now()` and others do not do the right thing and encode the system timezone. Rather they record a time without timezone. I have seen this cause so many problems because people are just not aware.
Actually, naïve times are considered aware in the system time zone. There's no good way to create a `tzinfo` object that behaves like "the system time zone" and doesn't have unfortunate consequences. See this article: https://blog.ganssle.io/articles/2022/04/naive-local-datetim...
It's not an ideal situation, but given path dependence I don't think it can be improved much from here.