Merge pull request 'thubrecht/multiday-event' (#58) from thubrecht/multiday-event into master
Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/58
This commit is contained in:
commit
ab00fede2e
|
@ -56,7 +56,10 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
{#if event.allDay}
|
{#if event.extendedProps.simAllDay}
|
||||||
|
<Icon name="calendar-range" class="text-primary" />
|
||||||
|
<span class="ms-1">{dateFormat(event.start)} ({timeFormat(event.extendedProps.realStart)}) - {dateFormat(event.end)} ({timeFormat(event.extendedProps.realEnd)})</span>
|
||||||
|
{:else if event.allDay}
|
||||||
<Icon name="calendar-range" class="text-primary" />
|
<Icon name="calendar-range" class="text-primary" />
|
||||||
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
|
<span class="ms-1">{dateFormat(event.start)} - {dateFormat(event.end)}</span>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
@ -132,13 +132,31 @@ function fcEventFromjCalEvent(cal) {
|
||||||
return function (evt) {
|
return function (evt) {
|
||||||
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 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: evt.dtstart,
|
start: evt.dtstart,
|
||||||
end: evt.dtend,
|
end: evt.dtend,
|
||||||
color: cal.color,
|
color: cal.color,
|
||||||
textColor: invertColor(cal.color),
|
textColor: invertColor(cal.color),
|
||||||
duration: end - start // in ms
|
duration: duration
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allDay && (duration > dayMs - 1)) {
|
||||||
|
fcEvent.allDay = true
|
||||||
|
fcEvent.simAllDay = true
|
||||||
|
|
||||||
|
fcEvent.realStart = new Date(start)
|
||||||
|
fcEvent.realEnd = new Date(end)
|
||||||
|
|
||||||
|
fcEvent.start = start.setUTCHours(0, 0, 0)
|
||||||
|
fcEvent.end = end.setUTCHours(23, 59, 59)
|
||||||
|
fcEvent.duration = end - start // Update the duration
|
||||||
}
|
}
|
||||||
|
|
||||||
fcEvent.calendar = cal.name
|
fcEvent.calendar = cal.name
|
||||||
|
|
Loading…
Reference in a new issue