Fix: correctly handle date-only recurring ical events (#6875)
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled

This commit is contained in:
shamoon
2026-07-16 14:34:27 -07:00
committed by GitHub
parent 19a9b39bdd
commit fc696a1b89
2 changed files with 47 additions and 0 deletions
@@ -85,6 +85,14 @@ export default function Integration({ config, params, setEvents, hideErrors, tim
const getOcurrencesFromRange = (event) => {
if (!event.rrule) {
if (event.dtstart.compare(rangeStart) >= 0 && event.dtend.compare(rangeEnd) <= 0) {
if (event.type === "vevent" && event.dtstart.isDate && event.dtend.isDate) {
const occurrences = [];
for (const date = event.dtstart.clone(); date.compare(event.dtend) < 0; date.day += 1) {
occurrences.push(date.clone());
}
return occurrences;
}
return [event.dtstart];
}
@@ -61,4 +61,43 @@ describe("widgets/calendar/integrations/ical", () => {
expect(event.url).toBe("https://example.com");
expect(event.isCompleted).toBe(false);
});
it("adds an all-day event on every day before its exclusive end date", async () => {
useWidgetAPI.mockReturnValue({
data: {
data: [
"BEGIN:VCALENDAR",
"VERSION:2.0",
"PRODID:-//Homepage Test//iCal Multi-Day Event//EN",
"BEGIN:VEVENT",
"UID:multi-day-all-day@example.test",
"DTSTAMP:20260716T000000Z",
"DTSTART;VALUE=DATE:20260716",
"DTEND;VALUE=DATE:20260719",
"SUMMARY:Three-day PTO",
"END:VEVENT",
"END:VCALENDAR",
"",
].join("\n"),
},
error: undefined,
});
const setEvents = vi.fn();
render(
<Integration
config={{ name: "PTO", type: "ical", color: "red" }}
params={{ start: "2026-04-16", end: "2026-10-16" }}
setEvents={setEvents}
hideErrors
timezone="America/Los_Angeles"
/>,
);
await waitFor(() => expect(setEvents).toHaveBeenCalled());
const updater = setEvents.mock.calls[0][0];
const entries = Object.values(updater({}));
expect(entries.map((event) => event.date.toISODate()).sort()).toEqual(["2026-07-16", "2026-07-17", "2026-07-18"]);
});
});