From 69967b759fb37d641080f0e7d298a9d4808f8d20 Mon Sep 17 00:00:00 2001 From: Lars Lehmann Date: Thu, 23 Jan 2025 21:29:49 +0100 Subject: [PATCH] fix: Error loading calender when transport has no date --- frontend/src/routes/collections/[id]/+page.svelte | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/routes/collections/[id]/+page.svelte b/frontend/src/routes/collections/[id]/+page.svelte index 3a4c1f7..dea338f 100644 --- a/frontend/src/routes/collections/[id]/+page.svelte +++ b/frontend/src/routes/collections/[id]/+page.svelte @@ -90,12 +90,14 @@ if (transportations) { dates = dates.concat( - transportations.map((transportation) => ({ - id: transportation.id, - start: transportation.date || '', // Ensure it's a string - end: transportation.end_date || transportation.date || '', // Ensure it's a string - title: transportation.name + (transportation.type ? ` (${transportation.type})` : '') - })) + transportations + .filter((i) => i.date) + .map((transportation) => ({ + id: transportation.id, + start: transportation.date || '', // Ensure it's a string + end: transportation.end_date || transportation.date || '', // Ensure it's a string + title: transportation.name + (transportation.type ? ` (${transportation.type})` : '') + })) ); }