Incorrect utcoffset returned from timezones

Bug #310606 reported by dpjanes
4
Affects Status Importance Assigned to Milestone
pytz
Fix Released
Medium
Stuart Bishop

Bug Description

I have documented this issues I'm having here: http://code.davidjanes.com/blog/2008/12/22/pytz-utcoffset/

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

Revision history for this message
Stuart Bishop (stub) wrote :

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
>>> from datetime import datetime
>>> tz = pytz.timezone('America/St_Johns')
>>> ts = datetime(2009, 10, 31, 23, 30)
>>> str(tz.localize(ts, is_dst=0).tzinfo.utcoffset(None))
'-1 day, 20:30:00'
>>> str(tz.localize(ts, is_dst=1).tzinfo.utcoffset(None))
'-1 day, 21:30:00'

Stuart Bishop (stub)
Changed in pytz:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Stuart Bishop (stub)
Stuart Bishop (stub)
Changed in pytz:
status: Triaged → Fix Released
Revision history for this message
Justin Wood (Callek) (bugspam-callek) wrote :

This has regressed (c. f. https://bugs.launchpad.net/pytz/+bug/1324158 ) afaict

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.