From 9e9cf8618db01d16da175edc5fc407c3018716a1 Mon Sep 17 00:00:00 2001 From: minie4 Date: Sun, 21 Aug 2022 20:02:40 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Jump=20to=20next=20monday=20if=20it?= =?UTF-8?q?=20is=20weekend=20on=20pageload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/store.js b/src/store.js index 24cb871..8b2b6db 100644 --- a/src/store.js +++ b/src/store.js @@ -26,6 +26,11 @@ watch(language, (newValue) => { export const selectedDate = ref(new Date(new Date().setUTCHours(0, 0, 0, 0))); export const selectedDay = computed(() => selectedDate.value.getDay() - 1); +// Jump to next Monday if it is weekend +if (selectedDay.value == 5) + selectedDate.value = new Date(selectedDate.value.getTime() + 86400000 * 2); +if (selectedDay.value == -1) + selectedDate.value = new Date(selectedDate.value.getTime() + 86400000); export const timetable = ref({ trusted: true }); export const substitutions = ref([]);