mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 09:34:35 +08:00
making sure to use utc
This commit is contained in:
parent
0f286d67d4
commit
340ed1e458
2 changed files with 7 additions and 6 deletions
|
@ -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();
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue