feat: add date math for filters #1342

Merged
konrad merged 88 commits from feature/date-math into main 2022-03-28 17:30:43 +00:00
1 changed files with 16 additions and 6 deletions
Showing only changes of commit 9e7c258347 - Show all commits

View File

@ -121,12 +121,22 @@ export default {
// soonest before the later ones.
// We can't use the api sorting here because that sorts tasks with a due date after
// ones without a due date.
return [...this.tasks].sort((a, b) => {
const sortByDueDate = b.dueDate - a.dueDate
return sortByDueDate === 0
? b.id - a.id
: sortByDueDate
})
const tasksWithDueDate = [...this.tasks]
.filter(t => t.dueDate !== null)
.sort((a, b) => {
const sortByDueDate = a.dueDate - b.dueDate
return sortByDueDate === 0
? b.id - a.id
: sortByDueDate
})
const tasksWithoutDueDate = [...this.tasks]
.filter(t => t.dueDate === null)
return [
...tasksWithDueDate,
...tasksWithoutDueDate,
]
},
hasTasks() {
return this.tasks && this.tasks.length > 0