Files
blitzkit/src/core/blitzstars/getPeriodStart.ts
T

12 lines
364 B
TypeScript
Raw Normal View History

2023-06-19 17:35:28 +00:00
import { Period } from '../options/addPeriodSubCommands.js';
import getTimeDaysAgo from './getTimeDaysAgo.js';
2023-05-30 17:24:24 +00:00
2023-06-19 17:35:28 +00:00
export default function getPeriodStart(period: Exclude<Period, 'custom'>) {
2023-05-30 17:24:24 +00:00
if (period === 'career') {
return -Infinity;
2023-06-01 18:36:39 +00:00
} else if (period === 'today') {
2023-06-19 17:35:28 +00:00
return getTimeDaysAgo(0);
2023-05-30 17:24:24 +00:00
} else {
2023-06-19 17:35:28 +00:00
return getTimeDaysAgo(Number(period));
2023-05-30 17:24:24 +00:00
}
}