From f880ca91f9294d9d228a7e59e8b4888d9a038b19 Mon Sep 17 00:00:00 2001 From: alexf2015 Date: Fri, 4 Nov 2022 19:56:30 +0100 Subject: [PATCH] adopted date parser due to changes in EASEE API (#13654) Signed-off-by: Alexander Friese --- .../java/org/openhab/binding/easee/internal/Utils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/Utils.java b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/Utils.java index 586042944..d5fe4f375 100644 --- a/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/Utils.java +++ b/bundles/org.openhab.binding.easee/src/main/java/org/openhab/binding/easee/internal/Utils.java @@ -56,7 +56,12 @@ public final class Utils { * @return */ public static ZonedDateTime parseDate(String date) throws DateTimeParseException { - final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX"); + DateTimeFormatter formatter; + if (date.length() == 24) { + formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX"); + } else { + formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssX"); + } LOGGER.trace("parsing: {}", date); ZonedDateTime zdt = ZonedDateTime.parse(date, formatter); return zdt;