🐛 Fix issues with UTC time handling
- Using `.setUTCHours` can cause the day to shift at specific times
This commit is contained in:
12
src/util.js
12
src/util.js
@ -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())
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user