diff --git a/apps/skolplattformen-app/components/week.component.tsx b/apps/skolplattformen-app/components/week.component.tsx index 4b525fbb..01c3e174 100644 --- a/apps/skolplattformen-app/components/week.component.tsx +++ b/apps/skolplattformen-app/components/week.component.tsx @@ -121,7 +121,17 @@ export const Week = ({ child }: WeekProps) => { year, LanguageService.getLanguageCode() ) - const { data: menu } = useMenu(child) + let { data: menu } = useMenu(child) + + // Hide menu if we want to show next week but it is not monday yet. + // The menu for next week is not available until monday + const currentDate = moment() + const shouldShowLunchMenu = + menu[displayDate.isoWeekday() - 1] && + !(displayDate.isoWeekday() === 1 && currentDate.isoWeekday() !== 1) + if (!shouldShowLunchMenu) { + menu = [] + } const styles = useStyleSheet(themedStyles) diff --git a/apps/skolplattformen-app/package.json b/apps/skolplattformen-app/package.json index b228791d..c41f0927 100644 --- a/apps/skolplattformen-app/package.json +++ b/apps/skolplattformen-app/package.json @@ -82,7 +82,8 @@ "@formatjs/intl-pluralrules": "*", "@formatjs/intl-datetimeformat": "*", "jest": "*", - "react-native-clean-project": "*" + "react-native-clean-project": "*", + "mockdate": "*" }, "devDependencies": { "react-native-clean-project": "*"