Should not have negative DST offsets
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
Medium
|
Stuart Bishop |
Bug Description
In very few timezones pytz reports negative dst. This happens if a change to daylight saving time falls together with a reduction in GMT offset such that the last STD time gmt offset is higher than the DST gmt offset.
This happens for 'Europe/Kiev' and other TZ in that region and for 'Antarctica/Palmer' and 'America/Iqaluit'
I am suggesting the following fix tzfile.py
@@ -83,6 +83,14 @@
+
+ if dst < 0: # negative dst? : try beyond
+ for j in range(i+1, len(transitions)):
+ stdinf = ttinfo[lindexes[j]]
+ if not stdinf[1]:
+ break # found std time
+ dst = inf[0] - stdinf[0] # dst offset
+
tzname = inf[2]
# Round utcoffset and dst to the nearest minute or the
Related branches
Changed in pytz: | |
status: | Fix Committed → Fix Released |
This seems correct. The test suite passes with the patch, and I've added a test to test_tzinfo.py that fails without this fix and passes with it (VilniusCESTSta rtTestCase)