Regression (Incorrect utcoffset returned from timezones)
Bug #1324158 reported by
Justin Wood (Callek)
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Invalid
|
Undecided
|
Unassigned |
Bug Description
This is a regression of launchpad bug #310606.
It regressed between pytz==2014.1 and pytz==2014.3
Working code:
datetime.
'2011-06-27 02:00:00 PST-0800'
Failing code:
datetime.
'2011-06-27 02:00:00 LMT-0753'
pytz.timezone(
<DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>
... c.f. the external pull request where we discovered this issue: https:/
To post a comment you must log in.
Per the README, you need to use the following method to construct a localized datetime:
>>> import pytz "US/Pacific" ).localize( datetime. datetime( 2011, 6, 27, 2, 0, 0)).strftime( '%Y-%m- %d %H:%M:%S %Z%z')
>>> pytz.__version__
'2014.3'
>>> import datetime
>>> pytz.timezone(
'2011-06-27 02:00:00 PDT-0700'
Note that your original working code is not actually working, as it is reporting standard time when that timestamp is in the daylight savings time period starting 13th March 2011. What you are retrieving is the first timezone period stored in the database. Lots of early timezone transitions were added in 2013c.