🐛 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,7 +1,4 @@
import { classFilter } from "@/store";
export function getSubstitutionText(substitution) {
const includeClass = !classFilter.value || classFilter.value == "none";
export function getSubstitutionText(substitution, includeClass) {
const includeClassValue = includeClass ? "withClass" : "withoutClass";
// TODO: implement more texts
@ -48,3 +45,10 @@ export function getNextAndPrevDay(date) {
getDateSkippingWeekend(new Date(date.getTime() - 86400000)),
].map((e) => e.getTime());
}
export function setUTCMidnight(date) {
// Set the time to UTC midnight while keeping the correct date
return new Date(
Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())
);
}