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

Use configured time-zone when converting DateTimeType to ZonedDateTime #408

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

jlaur
Copy link
Contributor

@jlaur jlaur commented Dec 18, 2024

This removes usages of the deprecated DateTimeType method getZonedDateTime() and instead applies the time-zone configured in openHAB.

Related to openhab/openhab-core#3583
Resolves #404

@jlaur jlaur requested a review from a team as a code owner December 18, 2024 22:07
@jlaur jlaur force-pushed the 404-datetimetype-instant branch from 4c37b5c to 1a85f58 Compare December 18, 2024 22:12
@jlaur jlaur changed the title Use configured time-zone when converting DateTimeType to ZonedDateTime Use configured time-zone when converting DateTimeType to ZonedDateTime Dec 19, 2024
Copy link
Contributor

@florian-h05 florian-h05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Have you tested this?

@jlaur
Copy link
Contributor Author

jlaur commented Dec 23, 2024

Have you tested this?

Yes, given this:

openhab:update TestDateTime 2024-10-31T12:00:01-0800

and this rule code:

var zoned = time.toZDT(items.TestDateTime);
console.log(zoned.toString());

Initial:

2024-12-23 21:00:00.186 [INFO ] [enhab.automation.script.file.test.js] - 2024-10-31T21:00:01+01:00[Europe/Copenhagen]

After setting OH time-zone to "(GMT-1:00) America/Scoresbysund" and running the rule again:

2024-12-23 21:04:04.607 [INFO ] [enhab.automation.script.file.test.js] - 2024-10-31T18:00:01-02:00[America/Scoresbysund]

@florian-h05 florian-h05 added the enhancement New feature or request label Dec 23, 2024
@florian-h05 florian-h05 added this to the to be released milestone Dec 23, 2024
@florian-h05 florian-h05 merged commit 29c6231 into openhab:main Dec 23, 2024
4 checks passed
@florian-h05
Copy link
Contributor

Thanks for taking care of this!

@jlaur jlaur deleted the 404-datetimetype-instant branch December 23, 2024 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust use of deprecated DateTimeType::getZonedDateTime method in time::toZDT
2 participants