Merge "Fix localtz() function"

This commit is contained in:
Zuul 2024-03-19 01:30:14 +00:00 committed by Gerrit Code Review
commit e3fe357a51
2 changed files with 7 additions and 1 deletions
releasenotes/notes
yaql/standard_library

@ -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.

@ -322,7 +322,7 @@ def localtz():
yaql> localtz().hours yaql> localtz().hours
3.0 3.0
""" """
if python_time.daylight: if python_time.localtime().tm_isdst:
return TIMESPAN_TYPE(seconds=-python_time.altzone) return TIMESPAN_TYPE(seconds=-python_time.altzone)
else: else:
return TIMESPAN_TYPE(seconds=-python_time.timezone) return TIMESPAN_TYPE(seconds=-python_time.timezone)