Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time zone in datetime items doesn't work as intended #3520

Open
LukaNoah opened this issue Apr 2, 2023 · 1 comment
Open

Time zone in datetime items doesn't work as intended #3520

LukaNoah opened this issue Apr 2, 2023 · 1 comment
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@LukaNoah
Copy link

LukaNoah commented Apr 2, 2023

My problem occurs in both OH3.4.2 and the current OH4 snapshot.
The time zone [Europe/Berlin] is set in my system. I have some DateTime Items which can be set via the UI's DateTimePicker. The items then contain values such as 2023-03-24T07:30:00+0100. This corresponds to the setting in winter time when I set the values via the UI.
On the day after the dst setting, all corresponding alarms / timers were then offset by 1 hour. I then have to reset every value of every affected item via the UI. Then the correct value for daylight saving time is in the item, e.g. 2023-03-28T07:30:00+0200. When I try to script the times into a ZonedDateTime format, such as "2023-03-38T07:30:00+0200 [Europe/Berlin], into the items, I get a warning "Could not parse... " and the value does not change.

Here is the link to the OH forum.

I think OH should handle the summer/winter time changes based on the time zone specified in the system itself and adjust or take into account the values of the items accordingly. In my opinion, if you add the time zone to a variable in a script, it works as desired, but not with items.

zdt = ZonedDateTime.parse("2023-03-24T22:50:00+01:00[Europe/Berlin]")
logger.info zdt # => 2023-03-24T22:50+01:00[Europe/Berlin]
logger.info zdt + 1.month # => 2023-04-24T22:50+02:00[Europe/Berlin]

@LukaNoah LukaNoah added the bug An unexpected problem or unintended behavior of the Core label Apr 2, 2023
@jlaur
Copy link
Contributor

jlaur commented Apr 25, 2023

@LukaNoah - I think this is a duplicate of #2898?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

No branches or pull requests

2 participants