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
2 changes: 1 addition & 1 deletion defaultmodules/calendar/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ Module.register("calendar", {
thisEvent.title += ` (${count}/${maxCount})`;
splitEvents.push(thisEvent);

event.startDate = midnight.format("x");
event.startDate = midnight.clone().startOf("day").format("x"); // start next slice at 00:00, not 23:59
count += 1;
midnight = midnight.clone().add(1, "day").endOf("day"); // next day
}
Expand Down
26 changes: 26 additions & 0 deletions tests/configs/modules/calendar/calendarShowEndConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,32 @@ const calendarShowEndConfigs = {
}
}
]
},
slice_multiday_timed_start_midnight: {
address: "0.0.0.0",
ipWhitelist: [],
timeFormat: 24,
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
fade: false,
urgency: 0,
dateFormat: "Do.MMM, HH:mm",
fullDayEventDateFormat: "Do.MMM",
timeFormat: "absolute",
getRelative: 0,
sliceMultiDayEvents: true,
calendars: [
{
maximumEntries: 100,
url: "http://localhost:8080/tests/mocks/calendar_test_slice_multiday_timed.ics"
}
]
}
}
]
}
};

Expand Down
14 changes: 14 additions & 0 deletions tests/electron/modules/calendar_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,20 @@ describe("Calendar module", () => {
});
});

describe("sliceMultiDayEvents slice start time", () => {
it("sliced sub-events start at 00:00, not 23:59", async () => {
// Timed event Fri 25 Oct 12:00 -> Mon 28 Oct 08:00 (UTC) is sliced across
// several midnights. Every slice after the first must start at 00:00 of its
// day. Regression for the bug where they started at 23:59 instead.
await startCalendarShowEndScenario("slice_multiday_timed_start_midnight", "25 Oct 2024 06:00:00 GMT", "GMT");
const firstTimeCell = global.page.locator(".calendar .event .time").locator(`nth=${first}`);
await firstTimeCell.waitFor({ state: "visible" });
const times = await global.page.locator(".calendar .event .time").allTextContents();
expect(times.some((time) => time.includes("00:00"))).toBe(true);
expect(times.every((time) => !time.includes("23:59"))).toBe(true);
});
});

describe("germany timezone", () => {
it("Issue #unknown fullday timezone East of UTC edge", async () => {
await helpers.startApplication("tests/configs/modules/calendar/germany_at_end_of_day_repeating.js", "01 Oct 2024 10:38:00 GMT+02:00", [], "Europe/Berlin");
Expand Down
16 changes: 16 additions & 0 deletions tests/mocks/calendar_test_slice_multiday_timed.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//MagicMirror//slice regression//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:20241025T120000Z
DTEND:20241028T080000Z
DTSTAMP:20241024T153358Z
UID:slice-midnight-regression@magicmirror.test
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Timed multi-day slice
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR