Manually merged fixes from seve12.

Thanks to seve12 !

Related https://github.com/wekan/wekan/pull/5967
This commit is contained in:
Lauri Ojansivu 2025-12-22 23:18:01 +02:00
parent fc3bb962f7
commit ecfb0f0fdf
14 changed files with 457 additions and 20 deletions

View file

@ -232,6 +232,24 @@ class DueCardsComponent extends BlazeComponent {
});
}
// Normalize dueAt to timestamps for stable client-side ordering
const future = new Date('2100-12-31').getTime();
const toTime = v => {
if (v === null || v === undefined || v === '') return future;
if (v instanceof Date) return v.getTime();
const t = new Date(v);
if (!isNaN(t.getTime())) return t.getTime();
return future;
};
filteredCards.sort((a, b) => {
const x = toTime(a.dueAt);
const y = toTime(b.dueAt);
if (x > y) return 1;
if (x < y) return -1;
return 0;
});
if (process.env.DEBUG === 'true') {
console.log('dueCards client: filtered to', filteredCards.length, 'cards');
}