[Bug 1995452] [NEW] Invalid daylight saving time info for 'Europe/Dublin'

Kamila 1995452 at bugs.launchpad.net
Wed Nov 2 07:13:51 UTC 2022


Public bug reported:

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')

** Affects: python-tz (Ubuntu)
     Importance: Undecided
         Status: New

-- 
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:
  New

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