forked from DebaucheryLibrarian/traxxx
31 lines
588 B
JavaScript
31 lines
588 B
JavaScript
import dayjs from 'dayjs';
|
|
|
|
const dateRanges = {
|
|
latest: () => ({
|
|
after: '1900-01-01',
|
|
before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
|
|
orderBy: 'DATE_DESC',
|
|
}),
|
|
upcoming: () => ({
|
|
after: dayjs(new Date()).format('YYYY-MM-DD'),
|
|
before: '2100-01-01',
|
|
orderBy: 'DATE_ASC',
|
|
}),
|
|
new: () => ({
|
|
after: '1900-01-01',
|
|
before: '2100-01-01',
|
|
orderBy: 'CREATED_AT_DESC',
|
|
}),
|
|
all: () => ({
|
|
after: '1900-01-01',
|
|
before: '2100-01-01',
|
|
orderBy: 'DATE_DESC',
|
|
}),
|
|
};
|
|
|
|
function getDateRange(range) {
|
|
return dateRanges[range]();
|
|
}
|
|
|
|
export default getDateRange;
|