forked from GitHubMirrors/silverbullet-icalendar
Bump version to 0.2.9 and improve ISO localization logic
All checks were successful
Build SilverBullet Plug / build (push) Successful in 28s
All checks were successful
Build SilverBullet Plug / build (push) Successful in 28s
This commit is contained in:
2
PLUG.md
2
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
|
||||
|
||||
@@ -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<T>(obj: T, timezones?: any): DateToString<T> {
|
||||
}
|
||||
|
||||
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>;
|
||||
const localized = localDateString(new Date(obj + (obj.endsWith("Z") ? "" : "Z")));
|
||||
console.log(`[iCalendar] Localizing ISO String: Raw=${obj} -> PST=${localized}`);
|
||||
return localized as DateToString<T>;
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
|
||||
Reference in New Issue
Block a user