mirror of
https://github.com/wekan/wekan.git
synced 2026-01-30 13:15:16 +01:00
Manually merged fixes from seve12.
Thanks to seve12 ! Related https://github.com/wekan/wekan/pull/5967
This commit is contained in:
parent
fc3bb962f7
commit
ecfb0f0fdf
14 changed files with 457 additions and 20 deletions
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue