diff --git a/server/chat-plugins/daily-spotlight.ts b/server/chat-plugins/daily-spotlight.ts index 0d797d8e20..380b6c8236 100644 --- a/server/chat-plugins/daily-spotlight.ts +++ b/server/chat-plugins/daily-spotlight.ts @@ -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 = ''; diff --git a/server/chat-plugins/seasons.ts b/server/chat-plugins/seasons.ts index 06a20e4271..6e79e7fe89 100644 --- a/server/chat-plugins/seasons.ts +++ b/server/chat-plugins/seasons.ts @@ -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'); diff --git a/server/private-messages/index.ts b/server/private-messages/index.ts index 330f91a424..1c48b49a34 100644 --- a/server/private-messages/index.ts +++ b/server/private-messages/index.ts @@ -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(); diff --git a/server/roomlogs.ts b/server/roomlogs.ts index 15c99dae71..841a466339 100644 --- a/server/roomlogs.ts +++ b/server/roomlogs.ts @@ -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() {