Incorrect utcoffset returned from timezones
Bug #310606 reported by
dpjanes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
Medium
|
Stuart Bishop |
Bug Description
I have documented this issues I'm having here: http://
This issues seems to be (as far as I can tell) that pytz is returning the same first utcoffset from the Olson database rather than the one appropriate for the time passed in (or even at least the most recent definition). For example, utcoffset for America/St_Johns is returning -4:29, whereas we're expecting at least a number that is a multiple of 30 minutes.
Related branches
lp:~stub/pytz/tzinfo-api
(Merged)
Changed in pytz: | |
importance: | Undecided → Medium |
status: | New → Triaged |
assignee: | nobody → Stuart Bishop (stub) |
Changed in pytz: | |
status: | Triaged → Fix Released |
To post a comment you must log in.
Unfortunately, the documented Python API is not suitable for pytz here as pytz is trying hard to give correct answers.
>>> pytz.timezone( 'America/ St_Johns' ).utcoffset( datetime. now())
For one hour every year starting the hour before daylight savings time ends, there are two correct answers.
>>> import pytz 'America/ St_Johns' ) 0).tzinfo. utcoffset( None)) 1).tzinfo. utcoffset( None))
>>> from datetime import datetime
>>> tz = pytz.timezone(
>>> ts = datetime(2009, 10, 31, 23, 30)
>>> str(tz.localize(ts, is_dst=
'-1 day, 20:30:00'
>>> str(tz.localize(ts, is_dst=
'-1 day, 21:30:00'