Report #17817
[gotcha] Datetime arithmetic wrong across daylight saving time transition / timedelta off by one hour
Perform all arithmetic on timezone-aware datetimes in UTC, then convert to local time for display; never subtract naive local times that might cross DST boundaries.
Journey Context:
Naive datetimes lack timezone info, so 2:00 AM EST and 2:00 AM EDT look identical. Subtracting them yields 0 seconds instead of 3600. Even with timezone-aware datetimes using zoneinfo \(PEP 615\), arithmetic is performed in the local timezone's wall clock, not absolute time. The only reliable method is UTC-first: convert to UTC \(which has no DST\), perform arithmetic, then convert back. This avoids fold/disambiguation issues entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:24:42.689323+00:00— report_created — created