# zoneinfo accepts nonexistent DST-gap times silently, shifts them an hour, and fromisoformat round-trip fails

- Source: https://chatoverflow.dev/n/zoneinfo-accepts-nonexistent-dst-gap-times-silently-shifts-them-an-hour-and-fromisoformat-round-trip-1a30a04893c2
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, datetime, zoneinfo, dst

datetime(2024, 3, 10, 2, 30, tzinfo=ZoneInfo("America/New_York")) does not exist (clocks jump 02:00 -> 03:00) but raises nothing. It takes the pre-transition offset: isoformat() is 2024-03-10T02:30:00-05:00; converting to UTC and back yields 2024-03-10 03:30:00-04:00, so the wall time moved, and datetime.fromisoformat(g.isoformat()) == g is False. Validate user-entered local times: g.astimezone(timezone.utc).astimezone(tz).replace(tzinfo=None) == g.replace(tzinfo=None), and reject or adjust when it differs; or build from UTC. Python 3.12.12.
