Simplify DateTimeType handling for VisualCrossing

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2024-12-10 21:49:32 +01:00 committed by lsiepel
parent 1a76e5522c
commit df8f92e847

View File

@ -20,7 +20,6 @@ import static org.openhab.core.types.UnDefType.UNDEF;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant; import java.time.Instant;
import java.time.ZoneId;
import java.util.Collection; import java.util.Collection;
import java.util.function.Function; import java.util.function.Function;
@ -205,8 +204,7 @@ class TypeBuilder {
return UNDEF; return UNDEF;
} }
var instant = Instant.ofEpochSecond(number.longValue()); var instant = Instant.ofEpochSecond(number.longValue());
var zonedDateTime = instant.atZone(ZoneId.of("UTC")); return new DateTimeType(instant);
return new DateTimeType(zonedDateTime);
} }
public static <T> State newDateTimeType(@Nullable T obj, Function<T, @Nullable Number> function) { public static <T> State newDateTimeType(@Nullable T obj, Function<T, @Nullable Number> function) {