forked from GitHubMirrors/silverbullet-icalendar
Bump version to 0.2.4 and add timezone diagnostics
All checks were successful
Build SilverBullet Plug / build (push) Successful in 21s
All checks were successful
Build SilverBullet Plug / build (push) Successful in 21s
This commit is contained in:
2
PLUG.md
2
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
|
||||
|
||||
11
icalendar.ts
11
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<T>(obj: T): DateToString<T> {
|
||||
}
|
||||
|
||||
if (obj instanceof Date) {
|
||||
return localDateString(obj) as DateToString<T>;
|
||||
const localized = localDateString(obj);
|
||||
// console.log(`[iCalendar] Localized Date: ${obj.toISOString()} -> ${localized}`);
|
||||
return localized as DateToString<T>;
|
||||
}
|
||||
if (isIcsDateObjects(obj) && obj.date instanceof Date) {
|
||||
return localDateString(obj.date) as DateToString<T>;
|
||||
const localized = localDateString(obj.date);
|
||||
// console.log(`[iCalendar] Localized IcsDate: ${obj.date.toISOString()} -> ${localized}`);
|
||||
return localized as DateToString<T>;
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(obj)) {
|
||||
|
||||
Reference in New Issue
Block a user