fix(icalendar): Correctly format nested objects (dates) in RRULE properties

This commit is contained in:
2026-02-20 13:37:11 -08:00
parent 31ca364a7c
commit e5b063269f
2 changed files with 21 additions and 20 deletions

View File

@@ -207,7 +207,7 @@ Deno.test("expandRecurrences - object rrule (Reproduction of missing events)", (
});
Deno.test("expandRecurrences - object rrule with until (Reproduction)", () => {
Deno.test("expandRecurrences - object rrule with until", () => {
const now = new Date();
const start = new Date(now.getTime() - 10 * 86400000);
const startStr = localDateString(start);
@@ -216,25 +216,12 @@ Deno.test("expandRecurrences - object rrule with until (Reproduction)", () => {
const icsEvent = {
summary: "Object RRULE UNTIL Event",
start: startStr,
rrule: { frequency: "DAILY", until: { date: untilDate } } // Common ts-ics structure
rrule: { frequency: "DAILY", until: { date: untilDate } }
};
// Spy on console.error
let errorLogged = false;
const originalConsoleError = console.error;
console.error = (...args) => {
if (args[0].includes("Error expanding recurrence for Object RRULE UNTIL Event") &&
args[1].message.includes("Invalid UNTIL value")) {
errorLogged = true;
}
};
try {
expandRecurrences(icsEvent, 30);
} finally {
console.error = originalConsoleError;
}
assert(errorLogged, "Should have logged an error for invalid UNTIL object value");
const results = expandRecurrences(icsEvent, 30);
// Should now return multiple occurrences
assert(results.length > 1, `Expected > 1 occurrences, got ${results.length}`);
assertEquals(results[0].recurrent, true);
});