mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Simplify DateTimeType handling for VisualCrossing
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
1a76e5522c
commit
df8f92e847
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user