To fix wrong repeated fullday event displaying (MM 2.27)
Seongnoh Sean Yi edited this page Apr 27, 2024
·
5 revisions
In some MM versions (2.27 or something), Repeated full day events with Timezone are not displayed as normal.
IMPORTANT
Since V1.8.3, This fix has been included in the CX3* modules themselves, so you may not need this solution.
Example
The Single
event and Repeated
event both start at 0:00, but the Repeated
event is displayed as 2 hours delayed. The 2 hours
are derived from GMT+2 of the TimeZone of original event.
The wrong parsing logic of the default calendar module causes this bug.(https://github.com/MagicMirrorOrg/MagicMirror/issues/3422) I hope it will be fixed soon.
Until then, you can fix it on CX3 manually.
/* In your CX3 module configuration */
eventPayload: (payload) => {
for (let ev of payload) {
if (ev.fullDayEvent) {
let gap = +ev.endDate - +ev.startDate
if (gap % (1000 * 60 * 60 * 24) === 0) {
ev.startDate = new Date(+ev.startDate).setHours(0, 0, 0, 0)
ev.endDate = new Date(+ev.startDate + gap).setMilliseconds(-1)
}
}
}
return payload
},
Fixed Result