3 ms·
There are so many footguns in the datetime lib. That's why I use a Flake8 plugin to prohibit especially egregious footguns. https://github.com/jkittner/flake8
by EdwardDiego 2y ago
There are so many footguns in the datetime lib.
That's why I use a Flake8 plugin to prohibit especially egregious footguns.
https://github.com/jkittner/flake8-ban-utcnow https://github.com/jkittner/flake8-ban-utcnow
- raverbashing 2y agoHonestly yeah who in tarnation created that function and called it utcnow These things are really frustrating
- mark-r 2y agoYeah, utcnow is completely broken. They should have fixed it when they created datetime.timezone.utc, but they didn't. The recommendation is to use datetime.datetime.now(datetime.timezone.utc) instead. utcnow should be deprecated and eventually removed.