Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions defaultmodules/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
25 changes: 25 additions & 0 deletions tests/configs/modules/calendar/empty-day.js
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 8 additions & 0 deletions tests/electron/modules/calendar_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 11 additions & 0 deletions tests/mocks/calendar_test_empty_day.ics
Original file line number Diff line number Diff line change
@@ -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