import dayjs from 'dayjs';

const dateRanges = {
    new: () => ({
        after: '1900-01-01',
        before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
    }),
    upcoming: () => ({
        after: dayjs(new Date()).format('YYYY-MM-DD'),
        before: '2100-01-01',
    }),
    all: () => ({
        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,
};
