[icalendar] Adding ability to handle events without DTEND (#12482)
Signed-off-by: clinique <gael@lhopital.org>
This commit is contained in:
parent
963a73ee74
commit
af8202e668
|
@ -64,6 +64,7 @@ import biweekly.util.com.google.ical.compat.javautil.DateIterator;
|
||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
class BiweeklyPresentableCalendar extends AbstractPresentableCalendar {
|
class BiweeklyPresentableCalendar extends AbstractPresentableCalendar {
|
||||||
|
private static final Duration ONE_DAY = Duration.ofDays(1).minusNanos(1);
|
||||||
private final ICalendar usedCalendar;
|
private final ICalendar usedCalendar;
|
||||||
|
|
||||||
BiweeklyPresentableCalendar(InputStream streamed) throws IOException, CalendarException {
|
BiweeklyPresentableCalendar(InputStream streamed) throws IOException, CalendarException {
|
||||||
|
@ -343,11 +344,14 @@ class BiweeklyPresentableCalendar extends AbstractPresentableCalendar {
|
||||||
return Duration.ofMillis(eventDuration.toMillis());
|
return Duration.ofMillis(eventDuration.toMillis());
|
||||||
}
|
}
|
||||||
final DateStart start = vEvent.getDateStart();
|
final DateStart start = vEvent.getDateStart();
|
||||||
final DateEnd end = vEvent.getDateEnd();
|
if (start == null) {
|
||||||
if (start == null || end == null) {
|
|
||||||
return 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue