sort by due date, items with due dates come first

This commit is contained in:
2026-06-16 22:10:01 -07:00
parent 84e8f3fcdf
commit 6a376af572
+8
View File
@@ -270,6 +270,14 @@ class OrgTodoListView extends ItemView {
return true;
});
// sort by due date - items with due dates first!
this.filtered.sort((a, b) => {
if (a.dueDate && b.dueDate) return a.dueDate.localeCompare(b.dueDate);
if (a.dueDate) return -1; // a has a date, b doesn't → a first
if (b.dueDate) return 1; // b has a date, a doesn't → b first
return 0; // neither has a date → keep as-is
});
this.listEl.empty();
if (this.filtered.length === 0) {