Skip to content

Task loops with specific time not aware of daylight saving time? #9315

Closed Answered by Rapptz
f0xit asked this question in General
Discussion options

You must be logged in to vote

The problem is that the "local timezone" provided by Python via astimezone does not actually contain any transition information involving DST, rather it's just a fixed offset at a specific point of time.

https://github.com/python/cpython/blob/2cdc5189a6bc3157fddd814662bde99ecfd77529/Lib/datetime.py#L1965-L1975

If you want to support transitions in timezones then you should use zoneinfo instead, or dateutil.tz if you're on a Python version older than 3.9.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by f0xit
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants