From 269f9669965a6d757ff8aaa6683f37b8e9a0f27d Mon Sep 17 00:00:00 2001 From: Radovan Pieter Date: Wed, 7 Feb 2024 12:09:27 +0100 Subject: [PATCH] Fix localtz() function Closes-Bug: #2052593 Change-Id: I739b44829202f0edba94ff502cd06e6cba60a4d0 --- releasenotes/notes/bug-2052593-f683555b24f1fba7.yaml | 6 ++++++ yaql/standard_library/date_time.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bug-2052593-f683555b24f1fba7.yaml diff --git a/releasenotes/notes/bug-2052593-f683555b24f1fba7.yaml b/releasenotes/notes/bug-2052593-f683555b24f1fba7.yaml new file mode 100644 index 0000000..a54c5ce --- /dev/null +++ b/releasenotes/notes/bug-2052593-f683555b24f1fba7.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + The localtz YAQL function now returns daylight saving time when daylight + saving is actually enabled in the system. Previously it returned daylight + saving time if the system time zone has daylight saving time. diff --git a/yaql/standard_library/date_time.py b/yaql/standard_library/date_time.py index d13f359..0adc657 100644 --- a/yaql/standard_library/date_time.py +++ b/yaql/standard_library/date_time.py @@ -322,7 +322,7 @@ def localtz(): yaql> localtz().hours 3.0 """ - if python_time.daylight: + if python_time.localtime().tm_isdst: return TIMESPAN_TYPE(seconds=-python_time.altzone) else: return TIMESPAN_TYPE(seconds=-python_time.timezone)