mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-21 17:25:10 -05:00
Handle 25 hour days correctly (#10635)
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
Some checks are pending
Node.js CI / build (16.x) (push) Waiting to run
This commit is contained in:
parent
6ce2c653b4
commit
9f29c90db2
|
|
@ -52,7 +52,7 @@ function nextDaily() {
|
|||
|
||||
const midnight = new Date();
|
||||
midnight.setHours(24, 0, 0, 0);
|
||||
let timeout = setTimeout(nextDaily, midnight.valueOf() - Date.now());
|
||||
let timeout = setTimeout(nextDaily, midnight.getTime() - Date.now());
|
||||
|
||||
export async function renderSpotlight(roomid: RoomID, key: string, index: number) {
|
||||
let imgHTML = '';
|
||||
|
|
|
|||
|
|
@ -228,8 +228,7 @@ export function rollTimer() {
|
|||
void updateBadgeholders();
|
||||
const time = Date.now();
|
||||
const next = new Date();
|
||||
next.setHours(next.getHours() + 1);
|
||||
next.setMinutes(0, 0, 0);
|
||||
next.setHours(next.getHours() + 1, 0, 0, 0);
|
||||
updateTimeout = setTimeout(() => rollTimer(), next.getTime() - time);
|
||||
|
||||
const discussionRoom = Rooms.search('seasondiscussion');
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ export const PrivateMessages = new class {
|
|||
if (!PM.isParentProcess) return null!;
|
||||
const time = Date.now();
|
||||
// even though we expire once a week atm, we check once a day
|
||||
const nextMidnight = new Date(time + 24 * 60 * 60 * 1000);
|
||||
nextMidnight.setHours(0, 0, 1);
|
||||
const nextMidnight = new Date();
|
||||
nextMidnight.setHours(24, 0, 0, 0);
|
||||
if (this.clearInterval) clearTimeout(this.clearInterval);
|
||||
this.clearInterval = setTimeout(() => {
|
||||
void this.clearOffline();
|
||||
|
|
|
|||
|
|
@ -327,8 +327,8 @@ export class Roomlog {
|
|||
log.setupRoomlogStream();
|
||||
}
|
||||
const time = Date.now();
|
||||
const nextMidnight = new Date(time + 24 * 60 * 60 * 1000);
|
||||
nextMidnight.setHours(0, 0, 1);
|
||||
const nextMidnight = new Date();
|
||||
nextMidnight.setHours(24, 0, 0, 0);
|
||||
Roomlogs.rollLogTimer = setTimeout(() => Roomlog.rollLogs(), nextMidnight.getTime() - time);
|
||||
}
|
||||
truncate() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user