From ab0db17a4705165f74bfd18dc2d765c27759da5f Mon Sep 17 00:00:00 2001 From: sstent Date: Tue, 17 Feb 2026 07:58:46 -0800 Subject: [PATCH] Bump version to 0.2.9 and improve ISO localization logic --- PLUG.md | 2 +- icalendar.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/PLUG.md b/PLUG.md index a9250e3..52e8814 100644 --- a/PLUG.md +++ b/PLUG.md @@ -1,6 +1,6 @@ --- name: Library/sstent/icalendar/PLUG -version: 0.2.8 +version: 0.2.9 tags: meta/library files: - icalendar.plug.js diff --git a/icalendar.ts b/icalendar.ts index 8b387cc..294e87f 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.8"; +const VERSION = "0.2.9"; const CACHE_KEY = "icalendar:lastSync"; const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours @@ -95,8 +95,9 @@ function convertDatesToStrings(obj: T, timezones?: any): 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; + const localized = localDateString(new Date(obj + (obj.endsWith("Z") ? "" : "Z"))); + console.log(`[iCalendar] Localizing ISO String: Raw=${obj} -> PST=${localized}`); + return localized as DateToString; } if (Array.isArray(obj)) {