2019-11-15 01:37:17 +00:00
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
const dateRanges = {
|
2020-03-02 02:41:41 +00:00
|
|
|
latest: () => ({
|
2019-12-18 01:42:55 +00:00
|
|
|
after: '1900-01-01',
|
|
|
|
before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
|
2019-11-15 01:37:17 +00:00
|
|
|
}),
|
|
|
|
upcoming: () => ({
|
|
|
|
after: dayjs(new Date()).format('YYYY-MM-DD'),
|
2019-12-18 01:42:55 +00:00
|
|
|
before: '2100-01-01',
|
2019-11-15 01:37:17 +00:00
|
|
|
}),
|
|
|
|
all: () => ({
|
2019-12-18 01:42:55 +00:00
|
|
|
after: '1900-01-01',
|
|
|
|
before: '2100-01-01',
|
2019-11-15 01:37:17 +00:00
|
|
|
}),
|
|
|
|
};
|
|
|
|
|
|
|
|
function rangeDates(state) {
|
|
|
|
return dateRanges[state.range]();
|
|
|
|
}
|
|
|
|
|
|
|
|
function before(state) {
|
|
|
|
return dateRanges[state.range]().before;
|
|
|
|
}
|
|
|
|
|
|
|
|
function after(state) {
|
|
|
|
return dateRanges[state.range]().after;
|
|
|
|
}
|
|
|
|
|
2020-03-02 02:41:41 +00:00
|
|
|
function isNew(state) {
|
|
|
|
return state.batch === 'new' ? [true] : [true, false];
|
|
|
|
}
|
|
|
|
|
2019-11-15 01:37:17 +00:00
|
|
|
export default {
|
|
|
|
rangeDates,
|
|
|
|
before,
|
|
|
|
after,
|
2020-03-02 02:41:41 +00:00
|
|
|
isNew,
|
2019-11-15 01:37:17 +00:00
|
|
|
};
|