Generalized filters bar, added to network page.

This commit is contained in:
2019-11-15 02:37:17 +01:00
parent 23492bb5d0
commit 0575dbc7e4
17 changed files with 193 additions and 113 deletions

34
assets/js/ui/getters.js Normal file
View File

@@ -0,0 +1,34 @@
import dayjs from 'dayjs';
const dateRanges = {
new: () => ({
after: dayjs(new Date(0)).format('YYYY-MM-DD'),
before: dayjs(new Date()).format('YYYY-MM-DD'),
}),
upcoming: () => ({
after: dayjs(new Date()).format('YYYY-MM-DD'),
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'),
}),
all: () => ({
after: dayjs(new Date(0)).format('YYYY-MM-DD'),
before: dayjs(new Date(2 ** 42)).format('YYYY-MM-DD'),
}),
};
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,
};