mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 13:24:06 +00:00
add fix for sliceMultiDayEvents (#3543)
sliceMultiDayEvents occasionally gets the number of events wrong and produces too many rows Math.ceil() rounds up over 1.04 so we get an abnormal count then the calcs for the midnight loop control used different moment() functions, producing different results fixes #3542
This commit is contained in:
30
tests/configs/modules/calendar/sliceMultiDayEvents.js
Normal file
30
tests/configs/modules/calendar/sliceMultiDayEvents.js
Normal file
@@ -0,0 +1,30 @@
|
||||
let config = {
|
||||
timeFormat: 12,
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
hideDuplicates: false,
|
||||
maximumEntries: 100,
|
||||
sliceMultiDayEvents: true,
|
||||
calendars: [
|
||||
{
|
||||
maximumEntries: 100,
|
||||
url: "http://localhost:8080/tests/mocks/sliceMultiDayEvents.ics"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
Date.now = () => {
|
||||
return new Date("01 Sept 2024 10:38:00 GMT+2:00").valueOf();
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
@@ -129,4 +129,22 @@ describe("Calendar module", () => {
|
||||
await expect(doTestCount()).resolves.toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* RRULE TESTS:
|
||||
* Add any tests that check rrule functionality here.
|
||||
*/
|
||||
describe("sliceMultiDayEvents", () => {
|
||||
it("Issue #3452 split multiday in Europe", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/calendar/sliceMultiDayEvents.js", "01 Sept 2024 10:38:00 GMT+02:00", ["js/electron.js"], "Europe/Berlin");
|
||||
expect(global.page).not.toBeNull();
|
||||
const loc = await global.page.locator(".calendar .event");
|
||||
const elem = loc.first();
|
||||
await elem.waitFor();
|
||||
expect(elem).not.toBeNull();
|
||||
const cnt = await loc.count();
|
||||
expect(cnt).toBe(6);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
58
tests/mocks/sliceMultiDayEvents.ics
Normal file
58
tests/mocks/sliceMultiDayEvents.ics
Normal file
@@ -0,0 +1,58 @@
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//Google Inc//Google Calendar 70.9054//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
X-WR-CALNAME:Dirk Test
|
||||
X-WR-TIMEZONE:Europe/Berlin
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20240918
|
||||
DTEND;VALUE=DATE:20240919
|
||||
DTSTAMP:20240916T084410Z
|
||||
UID:2crbv1ijljc2kt9jclkgu5hqa0@google.com
|
||||
CREATED:20240916T083831Z
|
||||
LAST-MODIFIED:20240916T083831Z
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:1 day single
|
||||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20240919
|
||||
DTEND;VALUE=DATE:20240920
|
||||
RRULE:FREQ=YEARLY
|
||||
DTSTAMP:20240916T084410Z
|
||||
UID:6gb19havnq6vp2qput51e5rmml@google.com
|
||||
CREATED:20240916T083850Z
|
||||
LAST-MODIFIED:20240916T083850Z
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:1 day repeat
|
||||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20240920
|
||||
DTEND;VALUE=DATE:20240922
|
||||
DTSTAMP:20240916T084410Z
|
||||
UID:06e9u1trbqi3jbvstvq4qqutau@google.com
|
||||
CREATED:20240916T083902Z
|
||||
LAST-MODIFIED:20240916T083902Z
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:2 day single
|
||||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
DTSTART;VALUE=DATE:20240923
|
||||
DTEND;VALUE=DATE:20240925
|
||||
RRULE:FREQ=YEARLY
|
||||
DTSTAMP:20240916T084410Z
|
||||
UID:0ui78rk6hpcv8rmbb6nuonhmgg@google.com
|
||||
CREATED:20240916T083919Z
|
||||
LAST-MODIFIED:20240916T083919Z
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:2 day repeat
|
||||
TRANSP:TRANSPARENT
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
Reference in New Issue
Block a user