diff --git a/PLUG.md b/PLUG.md index ab80fdc..ac5dc68 100644 --- a/PLUG.md +++ b/PLUG.md @@ -1,6 +1,6 @@ --- name: Library/sstent/icalendar/PLUG -version: 0.2.3 +version: 0.2.4 tags: meta/library files: - icalendar.plug.js diff --git a/icalendar.ts b/icalendar.ts index 86980c8..c92ff76 100644 --- a/icalendar.ts +++ b/icalendar.ts @@ -3,12 +3,13 @@ import { localDateString } from "@silverbulletmd/silverbullet/lib/dates"; import { convertIcsCalendar, type IcsCalendar, type IcsEvent, type IcsDateObjects } from "ts-ics"; console.log("[iCalendar] Plug loading..."); +console.log(`[iCalendar] Environment Timezone Offset: ${new Date().getTimezoneOffset()} minutes`); // ============================================================================ // Constants // ============================================================================ -const VERSION = "0.2.3"; +const VERSION = "0.2.4"; const CACHE_KEY = "icalendar:lastSync"; const DEFAULT_CACHE_DURATION_SECONDS = 21600; // 6 hours @@ -85,10 +86,14 @@ function convertDatesToStrings(obj: T): DateToString { } if (obj instanceof Date) { - return localDateString(obj) as DateToString; + const localized = localDateString(obj); + // console.log(`[iCalendar] Localized Date: ${obj.toISOString()} -> ${localized}`); + return localized as DateToString; } if (isIcsDateObjects(obj) && obj.date instanceof Date) { - return localDateString(obj.date) as DateToString; + const localized = localDateString(obj.date); + // console.log(`[iCalendar] Localized IcsDate: ${obj.date.toISOString()} -> ${localized}`); + return localized as DateToString; } if (typeof obj === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(obj)) {