diff --git a/functions/index.js b/functions/index.js index a484e5331..5d26f4d10 100644 --- a/functions/index.js +++ b/functions/index.js @@ -960,7 +960,7 @@ exports.getLeaderboard = functions.https.onCall((request, response) => { } // console.log(lbdata); if (request.type === "daily") { - let resetTime = new Date(); + let resetTime = new Date(Date.now()); resetTime.setHours(0, 0, 0, 0); resetTime.setDate(resetTime.getUTCDate() + 1); resetTime = resetTime.valueOf(); diff --git a/public/js/leaderboards.js b/public/js/leaderboards.js index b23d2b93b..6c4aa11b2 100644 --- a/public/js/leaderboards.js +++ b/public/js/leaderboards.js @@ -97,19 +97,20 @@ function updateLeaderboards() { //daily let diffAsDate = new Date(dailyData.resetTime - Date.now()); - let diffHours = diffAsDate.getHours(); - let diffMinutes = diffAsDate.getMinutes(); - let diffSeconds = diffAsDate.getSeconds(); + let diffHours = diffAsDate.getUTCHours(); + let diffMinutes = diffAsDate.getUTCMinutes(); + let diffSeconds = diffAsDate.getUTCSeconds(); let resetString = ""; if (diffHours > 0) { resetString = `resets in ${diffHours} ${ diffHours == 1 ? "hour" : "hours" - }`; + } ${diffMinutes} ${diffMinutes == 1 ? "minute" : "minutes"} + `; } else if (diffMinutes > 0) { resetString = `resets in ${diffMinutes} ${ diffMinutes == 1 ? "minute" : "minutes" - }`; + } ${diffSeconds == 1 ? "second" : "seconds"}`; } else if (diffSeconds > 0) { resetString = `resets in ${diffSeconds} ${ diffSeconds == 1 ? "second" : "seconds"