Improved 'new' sorting.

This commit is contained in:
DebaucheryLibrarian
2020-08-19 21:48:55 +02:00
parent e896d52968
commit fd4477bc50
4 changed files with 30 additions and 15 deletions

View File

@@ -2,23 +2,23 @@ import dayjs from 'dayjs';
const dateRanges = {
latest: () => ({
after: '1900-01-01',
before: dayjs(new Date()).add(1, 'day').format('YYYY-MM-DD'),
after: '1900-01-01 00:00:00',
before: dayjs().format('YYYY-MM-DD HH:mm:ss'),
orderBy: 'DATE_DESC',
}),
upcoming: () => ({
after: dayjs(new Date()).format('YYYY-MM-DD'),
before: '2100-01-01',
after: dayjs().format('YYYY-MM-DD HH:mm:ss'),
before: '2100-01-01 00:00:00',
orderBy: 'DATE_ASC',
}),
new: () => ({
after: '1900-01-01',
before: '2100-01-01',
orderBy: 'CREATED_AT_DESC',
after: '1900-01-01 00:00:00',
before: '2100-01-01 00:00:00',
orderBy: ['CREATED_AT_DESC', 'DATE_ASC'],
}),
all: () => ({
after: '1900-01-01',
before: '2100-01-01',
after: '1900-01-01 00:00:00',
before: '2100-01-01 00:00:00',
orderBy: 'DATE_DESC',
}),
};