Fix display or real allDay events

This commit is contained in:
Tom Hubrecht 2022-10-25 10:38:09 +02:00
parent 642b45f018
commit 32d9b4d60c

View file

@ -133,27 +133,29 @@ function fcEventFromjCalEvent(cal) {
const start = new Date(evt.dtstart)
const end = new Date(evt.dtend)
const allDay = !evt.dtstart.endsWith('Z')
const duration = end - start // in ms
const dayMs = 24 * 3600 * 1000
const fcEvent = {
title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
start: start,
end: end,
start: evt.dtstart,
end: evt.dtend,
color: cal.color,
textColor: invertColor(cal.color),
duration: duration
}
if (duration > dayMs - 1) {
if (!allDay && (duration > dayMs - 1)) {
fcEvent.allDay = true
fcEvent.simAllDay = true
fcEvent.realStart = new Date(start)
fcEvent.realEnd = new Date(end)
fcEvent.start.setUTCHours(0, 0, 0)
fcEvent.end.setUTCHours(23, 59, 59)
fcEvent.start = start.setUTCHours(0, 0, 0)
fcEvent.end = end.setUTCHours(23, 59, 59)
fcEvent.duration = end - start // Update the duration
}