feat: wm8 and average tier calculation

This commit is contained in:
TresAbhi committed 2023-06-01 18:36:39 +00:00
1 parent c2fca42a86
commit a12f969251
15 files changed
+315 -328

No files matched your search

+9 -1
View File
@@ -3,8 +3,16 @@ import { StatPeriod } from '../options/addStatPeriodChoices.js';
export default function getPeriodicStart(period: StatPeriod) {
if (period === 'career') {
return -Infinity;
} else if (period === 'today') {
const now = new Date();
now.setHours(5, 0, 0, 0);
// If it's after 5:00 AM today, subtract one day
if (now.getTime() > Date.now()) now.setDate(now.getDate() - 1);
return now.getTime() / 1000;
} else {
const daysAgo = period === 'today' ? 0 : Number(period) - 1;
const daysAgo = Number(period) - 1;
const periodStart = new Date();
periodStart.setDate(periodStart.getDate() - daysAgo);