From fd6389b9236d0f90d4dc295f3c496861bb706541 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Mon, 9 Dec 2024 23:33:01 +0100 Subject: [PATCH] Simplify DateTimeType handling for DBQuery Signed-off-by: Jacob Laursen Signed-off-by: Ciprian Pascu --- .../binding/dbquery/internal/Value2StateConverter.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/internal/Value2StateConverter.java b/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/internal/Value2StateConverter.java index 57bcaef4ddd..24d2ccd96be 100644 --- a/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/internal/Value2StateConverter.java +++ b/bundles/org.openhab.binding.dbquery/src/main/java/org/openhab/binding/dbquery/internal/Value2StateConverter.java @@ -16,8 +16,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.time.Duration; import java.time.Instant; -import java.time.ZoneId; -import java.time.ZonedDateTime; import java.util.Base64; import java.util.Date; @@ -76,9 +74,9 @@ public class Value2StateConverter { private State convert2DateTime(Object value) { if (value instanceof Instant instant) { - return new DateTimeType(ZonedDateTime.ofInstant(instant, ZoneId.systemDefault())); + return new DateTimeType(instant); } else if (value instanceof Date date) { - return new DateTimeType(ZonedDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault())); + return new DateTimeType(date.toInstant()); } else if (value instanceof String string) { return new DateTimeType(string); } else {