feat: updated /tankstats

This commit is contained in:
TresAbhi committed 2023-05-30 17:24:24 +00:00
1 parent 50369e9225
commit 831300cf69
13 files changed
+300 -272

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
export default function getPeriodNow() {
return new Date().getTime() / 1000;
}
+15
View File
@@ -0,0 +1,15 @@
import { StatPeriod } from '../options/addStatPeriodChoices.js';
export default function getPeriodicStart(period: StatPeriod) {
if (period === 'career') {
return -Infinity;
} else {
const daysAgo = period === 'today' ? 0 : Number(period) - 1;
const periodStart = new Date();
periodStart.setDate(periodStart.getDate() - daysAgo);
periodStart.setHours(5, 0, 0, 0);
return periodStart.getTime() / 1000;
}
}