Fix: Handle potential Date objects in event start and iterate to 0.3.23
All checks were successful
Build SilverBullet Plug / build (push) Successful in 29s

This commit is contained in:
2026-02-18 10:04:54 -08:00
parent 606fca25a8
commit 53a3c0e5db
6 changed files with 14 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
--- ---
name: Library/sstent/icalendar name: Library/sstent/icalendar
version: "0.3.22" version: "0.3.23"
tags: meta/library tags: meta/library
files: files:
- icalendar.plug.js - icalendar.plug.js

View File

@@ -1,6 +1,6 @@
{ {
"name": "icalendar-plug", "name": "icalendar-plug",
"version": "0.3.22", "version": "0.3.23",
"nodeModulesDir": "auto", "nodeModulesDir": "auto",
"tasks": { "tasks": {
"sync-version": "deno run -A scripts/sync-version.ts", "sync-version": "deno run -A scripts/sync-version.ts",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
name: icalendar name: icalendar
version: 0.3.22 version: 0.3.23
author: sstent author: sstent
index: icalendar.ts index: icalendar.ts
# Legacy SilverBullet permission name # Legacy SilverBullet permission name

View File

@@ -1,7 +1,7 @@
import { clientStore, config, datastore, editor, index } from "@silverbulletmd/silverbullet/syscalls"; import { clientStore, config, datastore, editor, index } from "@silverbulletmd/silverbullet/syscalls";
import { convertIcsCalendar } from "https://esm.sh/ts-ics@2.4.0"; import { convertIcsCalendar } from "https://esm.sh/ts-ics@2.4.0";
const VERSION = "0.3.22"; const VERSION = "0.3.23";
const CACHE_KEY = "icalendar:lastSync"; const CACHE_KEY = "icalendar:lastSync";
console.log(`[iCalendar] Plug script executing at top level (Version ${VERSION})`); console.log(`[iCalendar] Plug script executing at top level (Version ${VERSION})`);
@@ -83,11 +83,14 @@ async function fetchAndParseCalendar(source: any, hourShift = 0): Promise<any[]>
} }
let wallTimeStr = ""; let wallTimeStr = "";
if (obj.local && typeof obj.local.date === "string") wallTimeStr = obj.local.date; if (obj.local && obj.local.date) {
else if (typeof obj.date === "string") wallTimeStr = obj.date; wallTimeStr = typeof obj.local.date === "string" ? obj.local.date : obj.local.date.toISOString?.() || String(obj.local.date);
} else if (obj.date) {
wallTimeStr = typeof obj.date === "string" ? obj.date : obj.date.toISOString?.() || String(obj.date);
}
if (!wallTimeStr) { if (!wallTimeStr) {
console.warn("[iCalendar] Skipping event with no start date string:", icsEvent.summary, "Start object structure:", JSON.stringify(obj)); console.warn("[iCalendar] Skipping event with no start date string:", icsEvent.summary, "Start object structure:", JSON.stringify(obj), "typeof date:", typeof obj.date, "typeof local.date:", typeof obj.local?.date);
continue; continue;
} }