fix: 🐛 Hide lunch in timetable if not showing current week (#613)
✅ Closes: #599
This commit is contained in:
parent
9e9833bc8a
commit
a40af3e94d
|
@ -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)
|
||||
|
||||
|
|
|
@ -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": "*"
|
||||
|
|
Loading…
Reference in New Issue