fix(calendar): sliced multi-day events start at 00:00, not 23:59 (#4208)

This commit is contained in:
ago1776
2026-07-17 21:08:14 +02:00
committed by GitHub
parent f5ef002905
commit e368fd6c8c
4 changed files with 57 additions and 1 deletions
+1 -1
View File
@@ -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
}
@@ -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"
}
]
}
}
]
}
};
+14
View File
@@ -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");
@@ -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