mirror of
https://github.com/tiennm99/loldle.git
synced 2026-10-11 03:13:42 +00:00
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:
1 parent
31d7127396
commit
9b32b8889c
1 file changed
+6
-2
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user