Fix display or real allDay events
This commit is contained in:
parent
642b45f018
commit
32d9b4d60c
1 changed files with 7 additions and 5 deletions
|
@ -133,27 +133,29 @@ function fcEventFromjCalEvent(cal) {
|
||||||
const start = new Date(evt.dtstart)
|
const start = new Date(evt.dtstart)
|
||||||
const end = new Date(evt.dtend)
|
const end = new Date(evt.dtend)
|
||||||
|
|
||||||
|
const allDay = !evt.dtstart.endsWith('Z')
|
||||||
|
|
||||||
const duration = end - start // in ms
|
const duration = end - start // in ms
|
||||||
const dayMs = 24 * 3600 * 1000
|
const dayMs = 24 * 3600 * 1000
|
||||||
|
|
||||||
const fcEvent = {
|
const fcEvent = {
|
||||||
title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
|
title: `${cal.short_name ?? cal.name} : ${evt.summary}`,
|
||||||
start: start,
|
start: evt.dtstart,
|
||||||
end: end,
|
end: evt.dtend,
|
||||||
color: cal.color,
|
color: cal.color,
|
||||||
textColor: invertColor(cal.color),
|
textColor: invertColor(cal.color),
|
||||||
duration: duration
|
duration: duration
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration > dayMs - 1) {
|
if (!allDay && (duration > dayMs - 1)) {
|
||||||
fcEvent.allDay = true
|
fcEvent.allDay = true
|
||||||
fcEvent.simAllDay = true
|
fcEvent.simAllDay = true
|
||||||
|
|
||||||
fcEvent.realStart = new Date(start)
|
fcEvent.realStart = new Date(start)
|
||||||
fcEvent.realEnd = new Date(end)
|
fcEvent.realEnd = new Date(end)
|
||||||
|
|
||||||
fcEvent.start.setUTCHours(0, 0, 0)
|
fcEvent.start = start.setUTCHours(0, 0, 0)
|
||||||
fcEvent.end.setUTCHours(23, 59, 59)
|
fcEvent.end = end.setUTCHours(23, 59, 59)
|
||||||
fcEvent.duration = end - start // Update the duration
|
fcEvent.duration = end - start // Update the duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue