From 1a6085063745e0125fae6a665159a06685be4a3c Mon Sep 17 00:00:00 2001 From: Camille Moussu <66134347+Eriikah@users.noreply.github.com> Date: Tue, 16 Dec 2025 14:06:16 +0100 Subject: [PATCH] [#378] addressed code rabbit out of scope comments (#422) Co-authored-by: Camille Moussu --- src/App.tsx | 2 +- src/features/Events/EventDisplayPreview.tsx | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f254d4f..1ac8242 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -50,7 +50,7 @@ function App() { const lang = [userLanguage, settingsLanguage, savedLang, defaultLang].find( - (l): l is string => isValidLanguage(l) + (l) => !!l && isValidLanguage(l) ) || "en"; const dispatch = useAppDispatch(); diff --git a/src/features/Events/EventDisplayPreview.tsx b/src/features/Events/EventDisplayPreview.tsx index c1651a7..f3dd49a 100644 --- a/src/features/Events/EventDisplayPreview.tsx +++ b/src/features/Events/EventDisplayPreview.tsx @@ -992,10 +992,9 @@ function formatEnd( const startDate = new Date(start); const endDate = new Date(end); - const sameDay = - startDate.getFullYear() === endDate.getFullYear() && - startDate.getMonth() === endDate.getMonth() && - startDate.getDate() === endDate.getDate(); + const formatDatePart = (d: Date) => + d.toLocaleDateString("en-CA", { timeZone }); // YYYY-MM-DD format + const sameDay = formatDatePart(startDate) === formatDatePart(endDate); if (allday) { return sameDay