Bump version to 0.2.8 and add targeted logging for problematic UID
All checks were successful
Build SilverBullet Plug / build (push) Successful in 20s

This commit is contained in:
2026-02-17 07:45:24 -08:00
parent 2131bf4051
commit 56b6e7d0bf
2 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
--- ---
name: Library/sstent/icalendar/PLUG name: Library/sstent/icalendar/PLUG
version: 0.2.6 version: 0.2.8
tags: meta/library tags: meta/library
files: files:
- icalendar.plug.js - icalendar.plug.js

View File

@@ -2,7 +2,7 @@ import { clientStore, config, datastore, editor, index } from "@silverbulletmd/s
import { localDateString } from "@silverbulletmd/silverbullet/lib/dates"; import { localDateString } from "@silverbulletmd/silverbullet/lib/dates";
import { convertIcsCalendar, type IcsCalendar, type IcsEvent, type IcsDateObjects } from "ts-ics"; 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 CACHE_KEY = "icalendar:lastSync";
const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours
@@ -90,11 +90,12 @@ function convertDatesToStrings<T>(obj: T, timezones?: any): DateToString<T> {
} }
if (isIcsDateObjects(obj) && obj.date instanceof Date) { if (isIcsDateObjects(obj) && obj.date instanceof Date) {
const localized = localDateString(obj.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<T>; return localized as DateToString<T>;
} }
if (typeof obj === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(obj)) { 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<T>; return localDateString(new Date(obj)) as DateToString<T>;
} }
@@ -199,6 +200,9 @@ async function fetchAndParseCalendar(source: Source): Promise<CalendarEvent[]> {
} }
return await Promise.all(calendar.events.map(async (icsEvent: IcsEvent): Promise<CalendarEvent> => { return await Promise.all(calendar.events.map(async (icsEvent: IcsEvent): Promise<CalendarEvent> => {
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) // Create unique ref by start date with UID or summary (handles recurring events)
const uniqueKey = `${icsEvent.start?.date || ''}${icsEvent.uid || icsEvent.summary || ''}`; const uniqueKey = `${icsEvent.start?.date || ''}${icsEvent.uid || icsEvent.summary || ''}`;
const ref = await sha256Hash(uniqueKey); const ref = await sha256Hash(uniqueKey);