🐛 Fix issues with UTC time handling

- Using `.setUTCHours` can cause the day to shift at specific times
This commit is contained in:
2023-06-11 23:54:18 +02:00
parent dee01cc21a
commit dac0d09167
5 changed files with 40 additions and 24 deletions

View File

@ -1,5 +1,5 @@
import { ref, watch, computed } from "vue";
import { getNextAndPrevDay } from "@/util";
import { getNextAndPrevDay, setUTCMidnight } from "@/util";
import i18n from "@/i18n";
/* Router */
@ -32,7 +32,7 @@ watch(theme, (newValue) => {
});
/* Date selector */
export const selectedDate = ref(new Date(new Date().setUTCHours(0, 0, 0, 0)));
export const selectedDate = ref(setUTCMidnight(new Date()));
export const selectedDay = computed(() => selectedDate.value.getDay() - 1);
// Jump to next Monday if it is weekend
if (selectedDay.value == 5)