More ToUniversalTime issues
description
OK, found just one case that I think is off by one hour. Here's the output of my tests with annotations:
DST off rule for Europe/Moscow: Oct lastSun 2:00s (3am (23:00 UTC) becomes 2am)
zone.ToLocalTime('2007-10-27 22:00'): '10/28/2007 2:00:00 AM'
zone.ToLocalTime('2007-10-27 22:30'): '10/28/2007 2:30:00 AM'
zone.ToLocalTime('2007-10-27 23:00'): '10/28/2007 3:00:00 AM' <- I think this should be 2:00 am...
zone.ToLocalTime('2007-10-27 23:30'): '10/28/2007 3:30:00 AM' <- ...and this should be 2:30 am...
zone.ToLocalTime('2007-10-28 00:00'): '10/28/2007 3:00:00 AM' <- ...instead of 4 am becoming 3 am
zone.ToLocalTime('2007-10-28 00:30'): '10/28/2007 3:30:00 AM'
zone.ToLocalTime('2007-10-28 01:00'): '10/28/2007 4:00:00 AM'
If you agree with my interpretation of the rule "2:00s", which is that 3am (23:00 UTC) should become 2am, then I think we should should see 23:00 UTC converted to 2:00 instead of 3:00. In that case my tests would look like this:
zone.ToLocalTime('2007-10-27 22:00'): '10/28/2007 2:00:00 AM'
zone.ToLocalTime('2007-10-27 22:30'): '10/28/2007 2:30:00 AM'
zone.ToLocalTime('2007-10-27 23:00'): '10/28/2007 2:00:00 AM'
zone.ToLocalTime('2007-10-27 23:30'): '10/28/2007 2:30:00 AM'
zone.ToLocalTime('2007-10-28 00:00'): '10/28/2007 3:00:00 AM'
I wanted to confirm that this behavior is not different in different zones with an "s" DST rule, so I tested Asia/Novosibirsk:
DST off rule for Asia/Novosibirsk: Oct lastSun 2:00s (3am (20:00 UTC) becomes 2am)
zone.ToLocalTime('2007-10-27 19:00'): '10/28/2007 2:00:00 AM'
zone.ToLocalTime('2007-10-27 19:30'): '10/28/2007 2:30:00 AM'
zone.ToLocalTime('2007-10-27 20:00'): '10/28/2007 3:00:00 AM'
zone.ToLocalTime('2007-10-27 20:30'): '10/28/2007 3:30:00 AM'
zone.ToLocalTime('2007-10-28 21:00'): '10/29/2007 3:00:00 AM'
zone.ToLocalTime('2007-10-28 21:30'): '10/29/2007 3:30:00 AM'
zone.ToLocalTime('2007-10-27 22:00'): '10/28/2007 4:00:00 AM'
and the behavior is consistent.
This is an insignificant issue for my needs, but may cause problems for someone automating a global manufacturing system or managing a large distribution system.
And I apologize if my terminology (3am "becomes" 2am) is confusing - I mean 3am "should be interpreted as" 2am.