I am trying to visually mark a task as overdue in DataviewJS. My code adds a ‘red flag’ for tasks that are overdue, but I can’t complete these tasks. I assume because the text of the task doesn’t match the actual tasks.
Any ideas on how to do mark tasks as overdue other than creating a separate dataview section with only overdue tasks?
Thank you!
```dataviewjs
let pages = dv.pages().file.tasks
for (let i = 0; i < pages.length; i++) {
if (moment(pages[i].datum, "DD-MM-YYYY").isBefore(moment(), "day")) {
pages[i].text = "🚩 " + pages[i].text
}
}
dv.taskList(pages)
My suggestion (in DQL, because JS isn’t my ground) is to group the tasks (overdue vs in time). For example (considering due as an inline field in task text):
TASK
FROM ""
WHERE !completed AND due
GROUP BY choice(due < date(today), "🚩 overdue", "🟢 in time") AS abc