mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-11-14 21:26:08 +01:00
feat: custom periods for /stats and /tankstats
This commit is contained in:
1 parent
78424c1535
commit
e0c1db2a0b
14 files changed
+125
-49
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { StatPeriod } from '../options/addStatPeriodChoices.js';
|
||||
import { StatPeriod } from '../options/addPeriodChoices.js';
|
||||
import getPeriodStartFromDaysAgo from './getPeriodStartFromDaysAgo.js';
|
||||
|
||||
export default function getPeriodicStart(period: StatPeriod) {
|
||||
if (period === 'career') {
|
||||
@@ -12,12 +13,6 @@ export default function getPeriodicStart(period: StatPeriod) {
|
||||
|
||||
return now.getTime() / 1000;
|
||||
} else {
|
||||
const daysAgo = Number(period) - 1;
|
||||
const periodStart = new Date();
|
||||
|
||||
periodStart.setDate(periodStart.getDate() - daysAgo);
|
||||
periodStart.setHours(5, 0, 0, 0);
|
||||
|
||||
return periodStart.getTime() / 1000;
|
||||
return getPeriodStartFromDaysAgo(Number(period));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user