fix: time zone compliant commands

This commit is contained in:
TresAbhi committed 2023-07-10 01:23:49 +00:00
1 parent dd0644e09f
commit 405f544774
11 files changed
+54 -30

No files matched your search

+7 -3
View File
@@ -1,12 +1,16 @@
import { BlitzServer } from '../../constants/servers.js';
import { Period } from '../discord/addPeriodSubCommands.js';
import getTimeDaysAgo from './getTimeDaysAgo.js';
export default function getPeriodStart(period: Exclude<Period, 'custom'>) {
export default function getPeriodStart(
server: BlitzServer,
period: Exclude<Period, 'custom'>,
) {
if (period === 'career') {
return -Infinity;
} else if (period === 'today') {
return getTimeDaysAgo(0);
return getTimeDaysAgo(server, 1);
} else {
return getTimeDaysAgo(parseInt(period));
return getTimeDaysAgo(server, parseInt(period));
}
}