Created
December 12, 2023 10:11
-
-
Save michelbl/e1052bbb517357c796cb5fccaba8ba04 to your computer and use it in GitHub Desktop.
A list of surprises, using datetimes with the python ecosystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import UTC | |
from zoneinfo import ZoneInfo | |
TZ_PARIS = ZoneInfo("Europe/Paris") | |
TZ_UTC = UTC | |
# datetime equality is bugged | |
datetime(2023, 10, 29, 2, 30, fold=0, tzinfo=TZ_PARIS) == datetime(2023, 10, 29, 2, 30, fold=1, tzinfo=TZ_PARIS) # True | |
datetime(2023, 10, 29, 2, 30, fold=0, tzinfo=TZ_PARIS).timestamp() == datetime(2023, 10, 29, 2, 30, fold=1, tzinfo=TZ_PARIS).timestamp() # False | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment