pytz.exceptions:AmbiguousTimeError raised during DST end
Categories
(developer.mozilla.org Graveyard :: Code Cleanup, defect, P2)
Tracking
(Not tracked)
People
(Reporter: stephend, Unassigned)
References
()
Details
(Keywords: in-triage, Whiteboard: [fuzzer])
| Reporter | ||
Updated•10 years ago
|
Updated•10 years ago
|
Comment 1•10 years ago
|
||
Comment 2•10 years ago
|
||
Updated•10 years ago
|
Updated•10 years ago
|
Comment 3•8 years ago
|
||
Comment 4•8 years ago
|
||
Comment 5•8 years ago
|
||
Comment 6•8 years ago
|
||
Comment 7•7 years ago
|
||
Comment 8•7 years ago
|
||
I'm un-assigning myself, because I'm leaving the MDN team.
The issue is that there is an hour at the end of Daylight Saving Time (DST) where an hour (1 AM for Pacific US) repeats. We store naive times (times without timezone information) in MySQL, and Django raises an AmbiguousTimeError for times during this hour when converting to UTC, needed for many formats. One solution is to assume DST or no DST, which was done in https://github.com/mozilla/kuma/pull/4621 for all date code except for convert_to_utc. This code, used whenever serving an attachment, will raise an exception:
import datetime
from kuma.attachments.utils import convert_to_utc
convert_to_utc(datetime.datetime(2017, 11, 5, 1, 8, 42))
Converting this code would probably be a one-day task. It will start causing errors in November 2019, and it would be nice to fix this before then.
Longer-term solutions would be to centralize all this "convert to timezone-aware" code into one place. This may make it easier to transition to USE_TZ=True.
Comment 9•5 years ago
|
||
Updated•5 years ago
|
Description
•