From b304d57bf5d57d14cd495ba3f70e719acc978b68 Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Sun, 18 Aug 2024 03:25:15 +0200 Subject: [PATCH] fix todays opening hours being off by one day --- web/src/lib/openinghours.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/src/lib/openinghours.ts b/web/src/lib/openinghours.ts index 390be21..c53b57e 100644 --- a/web/src/lib/openinghours.ts +++ b/web/src/lib/openinghours.ts @@ -1,6 +1,7 @@ import { startOfToday, isAfter, + getISODay, parseISO, isSameDay, compareDesc, @@ -199,7 +200,7 @@ export function getTodaysOpeningHoursForFunction( if (!week) { return "?"; } - const weekdayIndex = startOfToday().getDay(); + const weekdayIndex = getISODay(startOfToday()) - 1; const weekday = WEEKDAYS[weekdayIndex]; const hours = week[weekday]; if (hours.timeFrom && hours.timeTo) {