From 17b4f72be67a3689e4835049328facfbcae0f2a5 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 17 Jun 2026 23:26:59 +0200 Subject: [PATCH] fix(dashboard): never crash on a malformed reservation date A reservation with an invalid date blanked the whole My Trips page: the old Upcoming widget did new Date(value).toISOString(), which throws "Invalid time value" (fixed in #1222 by reading the string parts). Also guard splitDate so a bad date renders a dash instead of "Invalid Date" or throwing. --- client/src/pages/DashboardPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/pages/DashboardPage.tsx b/client/src/pages/DashboardPage.tsx index 4dbd0917..82725064 100644 --- a/client/src/pages/DashboardPage.tsx +++ b/client/src/pages/DashboardPage.tsx @@ -38,6 +38,7 @@ function tripGradient(id: number): string { return GRADIENTS[id % GRADIENTS.leng function splitDate(dateStr: string | null | undefined, locale: string): { d: string; m: string } | null { if (!dateStr) return null const date = new Date(dateStr + 'T00:00:00Z') + if (isNaN(date.getTime())) return null // malformed date — render a dash, never crash return { d: date.toLocaleDateString(locale, { day: 'numeric', timeZone: 'UTC' }), m: date.toLocaleDateString(locale, { month: 'short', timeZone: 'UTC' }),