Invalid daylight saving time for Italy CET in 1976

Asked by Angelo on 2018-11-30

In 1976, Italy, the daylight saving time starts at may 30 and ends at september 26. However pytz reports always +1 hour (UTC+1) and not +2 (UTC+1 +1 hour for daylight saving time). This problem affects all dates before 1976-09-27.

# --- sample code
import datetime
import pytz

d1 = datetime.datetime(1976, 9, 26, 0, 0, 0, 0) # Last day in which daylight saving time is in effect
d2 = datetime.datetime(1976, 9, 27, 0, 0, 0, 0) # First dat after daylight saving time

cet = pytz.timezone("CET")

d1z = cet.localize(d1)
d2z = cet.localize(d2)

#-------

results:

d1z is "1976-09-26 00:00:00+01:00" <---- it should have been +02
d2z is "1976-09-27 00:00:00+01:00" <---- ok

Tried Pendulum and it seems having the same problem.

In Javascript it works:

new Date(1976, 8, 26) is "Sun Sep 26 1976 00:00:00 GMT+0200 (Ora legale dell’Europa centrale)"
new Date(1976, 8, 27) is "Mon Sep 27 1976 00:00:00 GMT+0100 (Ora standard dell’Europa centrale)"

references: https://www.timeanddate.com/time/change/italy?year=1976

Question information

Language:
English Edit question
Status:
Answered
For:
pytz Edit question
Assignee:
No assignee Edit question
Last query:
2018-11-30
Last reply:
2018-12-12
Stuart Bishop (stub) said : #1

pytz matches the upstream IANA database, so if it is incorrect it needs to be fixed there.

The IANA timezone database shows no changes in CET between 1945 and 1977 (zdump -v CET). I suspect this is correct, because the zone that correctly tracks Italy is Europe/Rome, not CET.

Europe/Rome Sat May 31 22:59:59 1975 UT = Sat May 31 23:59:59 1975 CET isdst=0 gmtoff=3600
Europe/Rome Sat May 31 23:00:00 1975 UT = Sun Jun 1 01:00:00 1975 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 27 22:59:59 1975 UT = Sun Sep 28 00:59:59 1975 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 27 23:00:00 1975 UT = Sun Sep 28 00:00:00 1975 CET isdst=0 gmtoff=3600
Europe/Rome Sat May 29 22:59:59 1976 UT = Sat May 29 23:59:59 1976 CET isdst=0 gmtoff=3600
Europe/Rome Sat May 29 23:00:00 1976 UT = Sun May 30 01:00:00 1976 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 25 22:59:59 1976 UT = Sun Sep 26 00:59:59 1976 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 25 23:00:00 1976 UT = Sun Sep 26 00:00:00 1976 CET isdst=0 gmtoff=3600
Europe/Rome Sat May 21 22:59:59 1977 UT = Sat May 21 23:59:59 1977 CET isdst=0 gmtoff=3600
Europe/Rome Sat May 21 23:00:00 1977 UT = Sun May 22 01:00:00 1977 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 24 22:59:59 1977 UT = Sun Sep 25 00:59:59 1977 CEST isdst=1 gmtoff=7200
Europe/Rome Sat Sep 24 23:00:00 1977 UT = Sun Sep 25 00:00:00 1977 CET isdst=0 gmtoff=3600

Angelo (gorgoroth) said : #2

I forgot to mention that I tried "Europe/Rome" with same results.

Can you help with this problem?

Provide an answer of your own, or ask Angelo for more information if necessary.

To post a message you must log in.