traxxx/assets/js/ui/getters.js

40 lines
752 B
JavaScript
Raw Normal View History

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