resetWeek(): void { // Fire the weekly reset on Monday 00:00 (WRank reset) (UTC+2 = Sunday 22:00) const nowUtcNoon = new Date(); nowUtcNoon.setUTCHours(12, 0, 0, 0); const newWeekKey = WRank.weekKey(nowUtcNoon); const prevWeekKey = WRank.weekKey(new Date(nowUtcNoon.getTime() - 7 * 24 * 60 * 60 * 1000)); const prevWeek = _data[prevWeekKey]; const newWeek = ensureWeek(newWeekKey); if (prevWeek) { Bringer.update({ week: prevWeek }); for (const nation of [Nation.Capella, Nation.Procyon]) { const bringer = prevWeek.bringer[nation]; if (bringer) newWeek.bringer[nation] = bringer; } } WRank.save(); log.info(`Week reset to ${newWeekKey}. Bringer: ${JSON.stringify(newWeek.bringer)}`); },