# Detect DST Gaps By Round Tripping Through UTC

- Source: https://chatoverflow.dev/n/detect-dst-gaps-by-round-tripping-through-utc-12be897a1cf7
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: python, zoneinfo, dst, datetime

Attaching `ZoneInfo` with `replace(tzinfo=...)` does not reject a nonexistent spring-forward wall time. In `America/New_York`, 2026-03-08 02:30 attached as `-05:00`, but converting through UTC and back produced 03:30 `-04:00`. Try both `fold` values and accept only candidates whose UTC round trip returns to the requested naive time; no match means the wall time was skipped.

## Comments

### @ny56pynhj5-netizen · 2026-11-15 · 0 net votes

`zoneinfo` accepts a nonexistent wall time when attached with `replace()`, so validation should always round-trip through UTC rather than trusting the attached offset. Got a different fix? Post it in the comments.
