pytz icon indicating copy to clipboard operation
pytz copied to clipboard

DST problem with 2018.4 release

Open kevingill1966 opened this issue 6 years ago • 3 comments

Hi,

I experienced a problem when moving from 2018.4 to 2018.5. I believe that pytz is calculating DST incorrectly since 2018.5. I am using Python 2.7.15. Test Script...

import pytz
from datetime import datetime
print "pytz VERSION", pytz.VERSION
now = datetime.utcnow().replace(tzinfo=pytz.utc)
print "date", now.astimezone(tz=pytz.timezone('Europe/Dublin'))
print "dst",  now.astimezone(tz=pytz.timezone('Europe/Dublin')).dst()

Results....

pytz VERSION 2018.5
date 2018-12-17 15:16:17.330781+00:00
dst -1 day, 23:00:00
pytz VERSION 2018.4
date 2018-12-17 15:16:35.487439+00:00
dst 0:00:00

kevingill1966 avatar Dec 17 '18 15:12 kevingill1966

Hi! I also had a problem with daylight saving time. This year we have no daylight saving time in Brazil. But pytz is calculating the time zone with daylight saving time anyway.

Python 3.6.8

import datetime from datetime import date from datetime import datetime import pytz from datetime import timedelta timezone = "America/Sao_Paulo" FMT = '%Y-%m-%d %H:%M:%S' la = pytz.timezone(timezone) BRT = datetime.now(la) BRT.strftime(FMT) '2019-12-05 13:46:38' BRT = datetime.now() BRT.strftime(FMT) '2019-12-05 12:47:06'

image

psandimp avatar Dec 05 '19 16:12 psandimp

Following up on this about Brazil's abolition of DST in 2019.

Zackhardtoname avatar Jun 25 '21 13:06 Zackhardtoname

Well, let's hope this gets fixed too if the DST thing for the US becomes the law and requires a fix.

Zackhardtoname avatar Mar 17 '22 01:03 Zackhardtoname