Improve date range precision.

This commit is contained in:
DebaucheryLibrarian
2020-09-11 02:29:14 +02:00
parent aa74c1c721
commit 471f8f2bec
3 changed files with 26 additions and 14 deletions

View File

@@ -5,23 +5,23 @@ dayjs.extend(utc);
const dateRanges = {
latest: () => ({
after: '1900-01-01 00:00:00',
before: dayjs.utc().format('YYYY-MM-DD HH:mm:ss'),
after: '1900-01-01',
before: dayjs.utc().toDate(),
orderBy: 'DATE_DESC',
}),
upcoming: () => ({
after: dayjs.utc().format('YYYY-MM-DD HH:mm:ss'),
before: '2100-01-01 00:00:00',
after: dayjs.utc().toDate(),
before: '2100-01-01',
orderBy: 'DATE_ASC',
}),
new: () => ({
after: '1900-01-01 00:00:00',
before: '2100-01-01 00:00:00',
before: '2100-01-01',
orderBy: ['CREATED_AT_DESC', 'DATE_ASC'],
}),
all: () => ({
after: '1900-01-01 00:00:00',
before: '2100-01-01 00:00:00',
after: '1900-01-01',
before: '2100-01-01',
orderBy: 'DATE_DESC',
}),
};