diff --git a/PLUG.md b/PLUG.md index 8d24350..a9250e3 100644 --- a/PLUG.md +++ b/PLUG.md @@ -1,6 +1,6 @@ --- name: Library/sstent/icalendar/PLUG -version: 0.2.6 +version: 0.2.8 tags: meta/library files: - icalendar.plug.js diff --git a/icalendar.ts b/icalendar.ts index 1db49be..8b387cc 100644 --- a/icalendar.ts +++ b/icalendar.ts @@ -2,7 +2,7 @@ import { clientStore, config, datastore, editor, index } from "@silverbulletmd/s import { localDateString } from "@silverbulletmd/silverbullet/lib/dates"; import { convertIcsCalendar, type IcsCalendar, type IcsEvent, type IcsDateObjects } from "ts-ics"; -const VERSION = "0.2.7"; +const VERSION = "0.2.8"; const CACHE_KEY = "icalendar:lastSync"; const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours @@ -90,11 +90,12 @@ function convertDatesToStrings(obj: T, timezones?: any): DateToString { } if (isIcsDateObjects(obj) && obj.date instanceof Date) { const localized = localDateString(obj.date); - console.log(`[iCalendar] Localizing ICS Date: UTC=${obj.date.toISOString()} -> PST=${localized} (TZID: ${obj.timezone || "none"})`); + console.log(`[iCalendar] Localizing ICS Date Object: UTC=${obj.date.toISOString()} -> PST=${localized} (TZID: ${obj.timezone || "none"})`); return localized as DateToString; } if (typeof obj === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(obj)) { + console.log(`[iCalendar] Localizing ISO String: ${obj}`); return localDateString(new Date(obj)) as DateToString; } @@ -199,6 +200,9 @@ async function fetchAndParseCalendar(source: Source): Promise { } return await Promise.all(calendar.events.map(async (icsEvent: IcsEvent): Promise => { + if (icsEvent.uid === "040000008200E00074C5B7101A82E0080000000010E384DCAC84DC0100000000000000001000000014AC664AB867C74D85FC0B77E881C5AE") { + console.log(`[iCalendar] Found target UID event:`, JSON.stringify(icsEvent, null, 2)); + } // Create unique ref by start date with UID or summary (handles recurring events) const uniqueKey = `${icsEvent.start?.date || ''}${icsEvent.uid || icsEvent.summary || ''}`; const ref = await sha256Hash(uniqueKey);