Skip to content

Commit

Permalink
Fix menu indexing on Sundays (day 0).
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatu Päkkilä committed Oct 8, 2023
1 parent e11242b commit 263df82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rssScraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', '');
}

0 comments on commit 263df82

Please sign in to comment.