traxxx/assets/js/ui/getters.js

35 lines
652 B
JavaScript
Raw Normal View History

import dayjs from 'dayjs';
const dateRanges = {
new: () => ({
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;
}
export default {
rangeDates,
before,
after,
};