diff --git a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/BiweeklyPresentableCalendar.java b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/BiweeklyPresentableCalendar.java index 935932328..02d64bbdf 100644 --- a/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/BiweeklyPresentableCalendar.java +++ b/bundles/org.openhab.binding.icalendar/src/main/java/org/openhab/binding/icalendar/internal/logic/BiweeklyPresentableCalendar.java @@ -64,6 +64,7 @@ import biweekly.util.com.google.ical.compat.javautil.DateIterator; */ @NonNullByDefault class BiweeklyPresentableCalendar extends AbstractPresentableCalendar { + private static final Duration ONE_DAY = Duration.ofDays(1).minusNanos(1); private final ICalendar usedCalendar; BiweeklyPresentableCalendar(InputStream streamed) throws IOException, CalendarException { @@ -343,11 +344,14 @@ class BiweeklyPresentableCalendar extends AbstractPresentableCalendar { return Duration.ofMillis(eventDuration.toMillis()); } final DateStart start = vEvent.getDateStart(); - final DateEnd end = vEvent.getDateEnd(); - if (start == null || end == null) { + if (start == null) { return null; } - return Duration.between(start.getValue().toInstant(), end.getValue().toInstant()); + final DateEnd end = vEvent.getDateEnd(); + if (end != null) { + return Duration.between(start.getValue().toInstant(), end.getValue().toInstant()); + } + return start.getValue().hasTime() ? Duration.ZERO : ONE_DAY; } /**