From 263df825e99907afcd0f5446a1d438e8b536afe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatu=20P=C3=A4kkil=C3=A4?= Date: Sun, 8 Oct 2023 11:39:26 +0300 Subject: [PATCH] Fix menu indexing on Sundays (day 0). --- src/rssScraper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rssScraper.ts b/src/rssScraper.ts index a39cb36..a1a1e63 100644 --- a/src/rssScraper.ts +++ b/src/rssScraper.ts @@ -88,7 +88,7 @@ export const scrapeRssFeed = async(url: string) => { } export const getCurrentDayDishes = (lunchList: any): string => { - const dayIndex = Math.min(new Date().getDay() - 1, 4); + const dayIndex = Math.max(0, Math.min(new Date().getDay() - 1, 4)); return lunchList[dayIndex].dishes.reduce((acc: string, cur: string) => acc += cur + '\n', ''); }