Bump version to 0.2.10 and add explicit date localization with logs
All checks were successful
Build SilverBullet Plug / build (push) Successful in 20s

This commit is contained in:
2026-02-17 08:05:41 -08:00
parent c422f0fae7
commit 9e54f0320e
2 changed files with 8 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
---
name: Library/sstent/icalendar/PLUG
version: 0.2.9
version: 0.2.10
tags: meta/library
files:
- 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 { convertIcsCalendar, type IcsCalendar, type IcsEvent, type IcsDateObjects } from "ts-ics";
const VERSION = "0.2.9";
const VERSION = "0.2.10";
const CACHE_KEY = "icalendar:lastSync";
const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours
@@ -85,18 +85,20 @@ function convertDatesToStrings<T>(obj: T, timezones?: any): DateToString<T> {
if (obj instanceof Date) {
const localized = localDateString(obj);
console.log(`[iCalendar] Localizing Date Object: UTC=${obj.toISOString()} -> PST=${localized}`);
console.log(`[iCalendar] MATCH Date Object: ${obj.toISOString()} -> PST=${localized}`);
return localized as DateToString<T>;
}
if (isIcsDateObjects(obj) && obj.date instanceof Date) {
const localized = localDateString(obj.date);
console.log(`[iCalendar] Localizing ICS Date Object: UTC=${obj.date.toISOString()} -> PST=${localized} (TZID: ${obj.timezone || "none"})`);
console.log(`[iCalendar] MATCH ICS Date Object: ${obj.date.toISOString()} -> PST=${localized} (TZID: ${obj.timezone || "none"})`);
return localized as DateToString<T>;
}
if (typeof obj === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(obj)) {
const localized = localDateString(new Date(obj + (obj.endsWith("Z") ? "" : "Z")));
console.log(`[iCalendar] Localizing ISO String: Raw=${obj} -> PST=${localized}`);
const forcedUTC = obj.endsWith("Z") ? obj : obj + "Z";
const dateObj = new Date(forcedUTC);
const localized = localDateString(dateObj);
console.log(`[iCalendar] MATCH ISO String: Raw=${obj} -> PST=${localized}`);
return localized as DateToString<T>;
}