Report #97055
[gotcha] Adding timedelta to naive local datetime crosses DST boundary producing wrong wall-clock time
Convert to UTC \(or timezone-aware UTC\) before arithmetic, then convert back to local
Journey Context:
timedelta represents absolute duration \(seconds\), not civil time. When a naive datetime represents local wall-clock time \(e.g., America/New\_York\), adding 24 hours via timedelta\(days=1\) during a DST transition \(spring forward\) results in 23 hours of elapsed time but 24 hours on the clock, or vice versa \(fall back\). The resulting datetime is off by the DST offset. Correct approach: convert to UTC \(which has no transitions\), perform arithmetic, then convert back. This is distinct from simple tz-aware vs naive comparison; it is about the semantics of arithmetic in non-linear timezones.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T21:29:26.315268+00:00— report_created — created