pytz
pytz copied to clipboard
DST problem with 2018.4 release
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
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'
Following up on this about Brazil's abolition of DST in 2019.
Well, let's hope this gets fixed too if the DST thing for the US becomes the law and requires a fix.