fix: use local date for daily seed instead of UTC

toISOString() returned UTC date, causing the daily game to reset at
UTC midnight rather than local midnight. Users in UTC+ timezones
would see yesterday's completed game until the UTC date rolled over.
This commit is contained in:
tiennm99 committed 2026-04-05 01:14:37 +07:00
1 parent 31d7127396
commit 9b32b8889c
1 file changed
+6 -2
+6 -2
View File
@@ -70,9 +70,13 @@ function hashString(str) {
return hash >>> 0;
}
/** Get today's date string for daily seed */
/** Get today's local date string for daily seed */
export function getTodaySeed() {
return new Date().toISOString().slice(0, 10);
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, "0");
const day = String(now.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
/** Get champion image URL from Data Dragon CDN */