From 1270e4d857070224b1ef1ddb1aa7dddbdb144216 Mon Sep 17 00:00:00 2001 From: Bas Buijsen <72604903+deBasMan21@users.noreply.github.com> Date: Mon, 31 Aug 2026 19:54:46 +0200 Subject: [PATCH 1/2] Update calendar.js --- defaultmodules/calendar/calendar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaultmodules/calendar/calendar.js b/defaultmodules/calendar/calendar.js index a183884db5..61ea7e3d81 100644 --- a/defaultmodules/calendar/calendar.js +++ b/defaultmodules/calendar/calendar.js @@ -595,9 +595,9 @@ Module.register("calendar", { if (eventsByDate[dateStr] && eventsByDate[dateStr].length > 0) { // If there are any events today then get all those events and select the currently active events and the events that are starting later in the day. newEvents.push(...eventsByDate[dateStr].filter((ev) => this.timestampToMoment(ev.endDate).isAfter(moment()))); - // Since we found a day with events, increase the daysCollected by 1 - daysCollected++; } + // Increment the daysCollected by one to ensure the while loop does not get stuck. + daysCollected++; // Search for the next day currentDate.add(1, "day"); } From 4225941f82170756dd7154424454a5e9db4cddb0 Mon Sep 17 00:00:00 2001 From: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Date: Wed, 9 Sep 2026 20:11:10 +0200 Subject: [PATCH 2/2] test: add regression test for empty calendar days --- tests/configs/modules/calendar/empty-day.js | 25 +++++++++++++++++++++ tests/electron/modules/calendar_spec.js | 8 +++++++ tests/mocks/calendar_test_empty_day.ics | 11 +++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/configs/modules/calendar/empty-day.js create mode 100644 tests/mocks/calendar_test_empty_day.ics diff --git a/tests/configs/modules/calendar/empty-day.js b/tests/configs/modules/calendar/empty-day.js new file mode 100644 index 0000000000..ea2fcfe34f --- /dev/null +++ b/tests/configs/modules/calendar/empty-day.js @@ -0,0 +1,25 @@ +const config = { + address: "0.0.0.0", + ipWhitelist: [], + timeFormat: 12, + + modules: [ + { + module: "calendar", + position: "bottom_bar", + config: { + limitDays: 3, + calendars: [ + { + url: "http://localhost:8080/tests/mocks/calendar_test_empty_day.ics" + } + ] + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/electron/modules/calendar_spec.js b/tests/electron/modules/calendar_spec.js index 3fb1392748..ea9d898db8 100644 --- a/tests/electron/modules/calendar_spec.js +++ b/tests/electron/modules/calendar_spec.js @@ -96,6 +96,14 @@ describe("Calendar module", () => { }); }); + describe("Empty calendar days", () => { + it("shows events scheduled after an empty calendar day (issue #4243)", async () => { + // event is on day 3 of the limitDays:3 window, days 1-2 are intentionally empty + await helpers.startApplication("tests/configs/modules/calendar/empty-day.js", "01 Jan 2030 12:30:00 GMT"); + await expect(doTestCount()).resolves.toBe(1); + }); + }); + /* * RRULE TESTS: * Add any tests that check rrule functionality here. diff --git a/tests/mocks/calendar_test_empty_day.ics b/tests/mocks/calendar_test_empty_day.ics new file mode 100644 index 0000000000..0833d4dadc --- /dev/null +++ b/tests/mocks/calendar_test_empty_day.ics @@ -0,0 +1,11 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//MagicMirror//Calendar Test//EN +BEGIN:VEVENT +UID:empty-day-test@magicmirror +DTSTAMP:20300101T000000Z +DTSTART;VALUE=DATE:20300103 +DTEND;VALUE=DATE:20300104 +SUMMARY:Event after empty day +END:VEVENT +END:VCALENDAR