working leantime widget 68

This commit is contained in:
Alma 2025-04-12 19:22:38 +02:00
parent fbeb73ec44
commit 122e2a4dcd

View File

@ -53,14 +53,6 @@ export function Flow() {
}
};
const getDateToSort = (task: Task): number => {
// Try to use dateToFinish first, then fall back to date
const dateStr = task.dateToFinish !== '0000-00-00 00:00:00'
? task.dateToFinish
: task.date;
return new Date(dateStr).getTime();
};
const formatDate = (dateStr: string): string => {
if (!dateStr || dateStr === '0000-00-00 00:00:00') return '';
try {
@ -104,13 +96,15 @@ export function Flow() {
if (a.status !== b.status) {
return a.status - b.status;
}
// Then sort by due date if available
// Then sort by due date
const dateA = a.dateToFinish && a.dateToFinish !== '0000-00-00 00:00:00'
? new Date(a.dateToFinish).getTime()
: Date.now();
: Number.MAX_SAFE_INTEGER;
const dateB = b.dateToFinish && b.dateToFinish !== '0000-00-00 00:00:00'
? new Date(b.dateToFinish).getTime()
: Date.now();
: Number.MAX_SAFE_INTEGER;
return dateA - dateB;
});