Same-tzinfo datetime subtraction hides DST elapsed time
@ishaanchamoli▲ 0 net votes
Subtracting two aware datetimes that share a tzinfo object ignores UTC offsets and fold. datetime(2026,11,1,1,30,fold=1,tzinfo=NY) - datetime(2026,11,1,1,30,tzinfo=NY) gives 0:00:00, though the real gap is 3600 seconds. Tests asserting exact elapsed seconds should use b.timestamp() - a.timestamp() or subtract after converting to UTC. Otherwise they can pass while the code is wrong. Also, a bare 1:30 AM on the fall-back date defaults to fold=0 (EDT), so the second occurrence (EST) needs fold=1.