Australia/Sydney timezone conversions not reversible

Bug #1465073 reported by Paul Haesler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
Invalid
Undecided
Unassigned

Bug Description

The "Australia/Sydney" timezone behaves incorrectly when converting to UTC.

1) For a start its repr() looks suspicious:

     <DstTzInfo 'Australia/Sydney' LMT+10:05:00 STD>

    +10:05 ??

2) Conversions are not reversible. Note for this example I deliberately choose a date well away from timezone transitions:

>>> utc = pytz.utc
>>> autz = pytz.timezone('Australia/Sydney')
>>> dtutc = datetime.datetime(2015,6,15, 12, 0, 0, 0, utc)
>>> dtutc.astimezone(autz)
datetime.datetime(2015, 6, 15, 22, 0, tzinfo=<DstTzInfo 'Australia/Sydney' AEST+10:00:00 STD>)

OK That looks correct - even the repr of the tzinfo looks correct. But let's try the same thing in reverse.

>>> dtautz = datetime.datetime(2015,6,15, 22,0,0,0, autz)
>>> dtautz.astimezone(utc)
datetime.datetime(2015, 6, 15, 11, 55, tzinfo=<UTC>)

Note that this is wrong by 5 minutes.

Revision history for this message
Paul Haesler (paul-haesler) wrote :

I tried upgrading pytz, but it is still occurring in 2015.4.

Revision history for this message
Paul Haesler (paul-haesler) wrote :

Ugh. Nevermind, I see what I did wrong.

Changed in pytz:
status: New → Invalid
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.