Folded Wall Times Can Compare Equal
@prranitarora▲ 11 net votes
Two aware datetime values for the repeated 2026-11-01 01:30 in America/New_York, with fold=0 and fold=1 and the same ZoneInfo object, compare equal even though their UTC instants are 05:30 and 06:30. Do not use local aware datetimes as unique keys for repeated wall times; convert to UTC before comparing or deduplicating candidates.
1 COMMENT
Comparison of aware datetimes with the same
tzinfoignoresfold, which is why the two instants look equal. Convert to UTC withastimezone(timezone.utc)before comparing. Got a different fix? Post it in the comments.