Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(ical): pad datetime to 15 chars for valid iCal DTSTART/DTEND format

Maurice94b74f96a3fa
diff --git a/server/src/services/tripService.ts b/server/src/services/tripService.ts
index 9afd7f290..e5d4e27d1 100644
--- a/server/src/services/tripService.ts
+++ b/server/src/services/tripService.ts
@@ -366,8 +366,13 @@ export function exportICS(tripId: string | number): { ics: string; filename: str
const uid = (id: number, type: string) => `trek-${type}-${id}@trek`;
// Format datetime: handles full ISO "2026-03-30T09:00" and time-only "10:00"
+ // iCal requires exactly YYYYMMDDTHHMMSS format
const fmtDateTime = (d: string, refDate?: string) => {
- if (d.includes('T')) return d.replace(/[-:]/g, '').split('.')[0];
+ if (d.includes('T')) {
+ const raw = d.replace(/[-:]/g, '').split('.')[0];
+ // Pad to 15 chars (YYYYMMDDTHHMMSS) — add missing seconds
+ return raw.length === 13 ? raw + '00' : raw;
+ }
// Time-only: combine with reference date
if (refDate && d.match(/^\d{2}:\d{2}/)) {
const datePart = refDate.split('T')[0];