working leantime widget 97

This commit is contained in:
Alma 2025-04-12 21:12:58 +02:00
parent 0d01d513ec
commit 0bf7c435db

View File

@ -140,7 +140,7 @@ export function Flow() {
validDate: getValidDate(task) validDate: getValidDate(task)
})) }))
.sort((a: TaskWithDate, b: TaskWithDate) => { .sort((a: TaskWithDate, b: TaskWithDate) => {
// If both tasks have dates, sort by date // If both tasks have dates, sort by date (oldest first)
if (a.validDate && b.validDate) { if (a.validDate && b.validDate) {
return a.validDate.getTime() - b.validDate.getTime(); return a.validDate.getTime() - b.validDate.getTime();
} }
@ -149,8 +149,7 @@ export function Flow() {
if (b.validDate) return 1; if (b.validDate) return 1;
// If neither has a date, sort by ID // If neither has a date, sort by ID
return a.id - b.id; return a.id - b.id;
}) });
.slice(0, 6);
console.log('Final sorted tasks:', sortedTasks.map((t: TaskWithDate) => ({ console.log('Final sorted tasks:', sortedTasks.map((t: TaskWithDate) => ({
id: t.id, id: t.id,