[Bug 1995452] Re: Invalid daylight saving time info for 'Europe/Dublin'
Benjamin Drung
1995452 at bugs.launchpad.net
Fri Apr 21 11:30:10 UTC 2023
Thank you for taking the time to report this bug and helping to make
Ubuntu better.
I rewrote your snippet with Python's zoneinfo (from Python >= 3.9):
```
import zoneinfo
from datetime import datetime, timedelta
def is_dst(zonename):
tz = zoneinfo.ZoneInfo(zonename)
now = datetime.now(tz=tz)
return now.dst() != timedelta(0)
is_dst('Europe/Dublin')
```
I verified that both code snippets work for Europe/Berlin. Then I looked
into tzdata and found the reason in `europe`:
# From Paul Eggert (2017-12-07):
# The 1996 anonymous contributor's goal was to determine the correct
# abbreviation for summer time in Dublin and so the contributor
# focused on the "IST", not on the "Irish Summer Time". Though the
# "IST" was correct, the "Irish Summer Time" appears to have been an
# error, as Ireland's Standard Time (Amendment) Act, 1971 states that
# standard time in Ireland remains at UT +01 and is observed in
# summer, and that Greenwich mean time is observed in winter. (Thanks
# to Derick Rethans for pointing out the error.) That is, when
# Ireland amended the 1968 act that established UT +01 as Irish
# Standard Time, it left standard time unchanged and established GMT
# as a negative daylight saving time in winter. So, in this database
# IST stands for Irish Summer Time for timestamps before 1968, and for
# Irish Standard Time after that. See:
# http://www.irishstatutebook.ie/eli/1971/act/17/enacted/en/print
So python-tz works correctly. If you want Europe/Dublin changed, please
contact upstream tzdata (see https://www.iana.org/time-zones).
** Description changed:
I'm trying to check if daylight saving time is in effect for the
'Europe/Dublin'. Executing the following line:
datetime.datetime.now(pytz.timezone('Europe/Dublin')).dst()
is giving 0 as a result, which is incorrect because during the day that
I was executing the command (2022/10/17) was still daylight saving time
in effect so the function should return a dst offset value.
The function below also returned the wrong result (False instead of
True) for the date 2022/10/17:
+ ```
import pytz
from datetime import datetime, timedelta
def is_dst(zonename):
- tz = pytz.timezone(zonename)
- now = pytz.utc.localize(datetime.utcnow())
- return now.astimezone(tz).dst() != timedelta(0)
+ tz = pytz.timezone(zonename)
+ now = pytz.utc.localize(datetime.utcnow())
+ return now.astimezone(tz).dst() != timedelta(0)
is_dst('Europe/Dublin')
+ ```
** Changed in: python-tz (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-tz in Ubuntu.
https://bugs.launchpad.net/bugs/1995452
Title:
Invalid daylight saving time info for 'Europe/Dublin'
Status in python-tz package in Ubuntu:
Invalid
Bug description:
I'm trying to check if daylight saving time is in effect for the
'Europe/Dublin'. Executing the following line:
datetime.datetime.now(pytz.timezone('Europe/Dublin')).dst()
is giving 0 as a result, which is incorrect because during the day
that I was executing the command (2022/10/17) was still daylight
saving time in effect so the function should return a dst offset
value.
The function below also returned the wrong result (False instead of
True) for the date 2022/10/17:
```
import pytz
from datetime import datetime, timedelta
def is_dst(zonename):
tz = pytz.timezone(zonename)
now = pytz.utc.localize(datetime.utcnow())
return now.astimezone(tz).dst() != timedelta(0)
is_dst('Europe/Dublin')
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-tz/+bug/1995452/+subscriptions
More information about the foundations-bugs
mailing list