From a9fe369abc151c0f1a6fb825d73af4c1abb4bfe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20H=C3=A1jek?= Date: Wed, 29 Jan 2025 08:48:43 +0100 Subject: [PATCH] =?UTF-8?q?Oprava=20mo=C5=BEnosti=20vybrat=20V=20kolik=20h?= =?UTF-8?q?odin=20preferuje=C5=A1=20odchod=20pro=20n=C3=A1sleduj=C3=ADc?= =?UTF-8?q?=C3=AD=20dny?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/Utils.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/Utils.tsx b/client/src/Utils.tsx index 7b89f51..d43bb67 100644 --- a/client/src/Utils.tsx +++ b/client/src/Utils.tsx @@ -53,7 +53,12 @@ export function isInTheFuture(time: DepartureTime) { const now = new Date(); const currentHours = now.getHours(); const currentMinutes = now.getMinutes(); + const currentDate = now.toDateString(); const [hours, minutes] = time.split(':').map(Number); - return hours > currentHours || (hours === currentHours && minutes > currentMinutes); + + if (currentDate === now.toDateString()) { + return hours > currentHours || (hours === currentHours && minutes > currentMinutes); + } + return true; }