Fix: Handle potential Date objects in event start and iterate to 0.3.23
All checks were successful
Build SilverBullet Plug / build (push) Successful in 29s

This commit is contained in:
2026-02-18 10:04:54 -08:00
parent 606fca25a8
commit 53a3c0e5db
6 changed files with 14 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
import { clientStore, config, datastore, editor, index } from "@silverbulletmd/silverbullet/syscalls";
import { convertIcsCalendar } from "https://esm.sh/ts-ics@2.4.0";
const VERSION = "0.3.22";
const VERSION = "0.3.23";
const CACHE_KEY = "icalendar:lastSync";
console.log(`[iCalendar] Plug script executing at top level (Version ${VERSION})`);
@@ -83,11 +83,14 @@ async function fetchAndParseCalendar(source: any, hourShift = 0): Promise<any[]>
}
let wallTimeStr = "";
if (obj.local && typeof obj.local.date === "string") wallTimeStr = obj.local.date;
else if (typeof obj.date === "string") wallTimeStr = obj.date;
if (obj.local && obj.local.date) {
wallTimeStr = typeof obj.local.date === "string" ? obj.local.date : obj.local.date.toISOString?.() || String(obj.local.date);
} else if (obj.date) {
wallTimeStr = typeof obj.date === "string" ? obj.date : obj.date.toISOString?.() || String(obj.date);
}
if (!wallTimeStr) {
console.warn("[iCalendar] Skipping event with no start date string:", icsEvent.summary, "Start object structure:", JSON.stringify(obj));
console.warn("[iCalendar] Skipping event with no start date string:", icsEvent.summary, "Start object structure:", JSON.stringify(obj), "typeof date:", typeof obj.date, "typeof local.date:", typeof obj.local?.date);
continue;
}