Fix getSunday function

pull/695/merge
Xavion3 2024-05-13 11:16:50 +10:00 committed by Samuel H
parent 347972d103
commit 22097a0c95
1 changed files with 3 additions and 3 deletions

View File

@ -117,9 +117,9 @@ export function randSeedEasedWeightedItem<T>(items: T[], easingFunction: string
}
export function getSunday(date: Date): Date {
const day = date.getDay();
const diff = date.getDate() - day;
const newDate = new Date(date.setDate(diff));
const day = date.getUTCDay();
const diff = date.getUTCDate() - day;
const newDate = new Date(date.setUTCDate(diff));
return new Date(Date.UTC(newDate.getUTCFullYear(), newDate.getUTCMonth(), newDate.getUTCDate()));
}