mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
Simplify DateTimeType handling for Java Persistence API
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
e794c6a0f6
commit
b2c9abbe29
@ -142,8 +142,7 @@ public class JpaHistoricItem implements HistoricItem {
|
||||
} else if (item instanceof RollershutterItem) {
|
||||
state = PercentType.valueOf(pItem.getValue());
|
||||
} else if (item instanceof DateTimeItem) {
|
||||
state = new DateTimeType(ZonedDateTime.ofInstant(Instant.ofEpochMilli(Long.parseLong(pItem.getValue())),
|
||||
ZoneId.systemDefault()));
|
||||
state = new DateTimeType(Instant.ofEpochMilli(Long.parseLong(pItem.getValue())));
|
||||
} else if (item instanceof LocationItem) {
|
||||
PointType pType = null;
|
||||
String[] comps = pItem.getValue().split(";");
|
||||
|
@ -37,7 +37,7 @@ public class StateHelper {
|
||||
*/
|
||||
public static String toString(State state) {
|
||||
if (state instanceof DateTimeType type) {
|
||||
return String.valueOf(type.getZonedDateTime().toInstant().toEpochMilli());
|
||||
return String.valueOf(type.getInstant().toEpochMilli());
|
||||
}
|
||||
if (state instanceof DecimalType type) {
|
||||
return String.valueOf(type.doubleValue());
|
||||
|
Loading…
Reference in New Issue
Block a user