This commit is contained in:
PhilReact 2025-05-21 21:29:35 +03:00
parent 21b3dd9d02
commit 0cfdd5cbc9

View File

@ -43,14 +43,15 @@ export function formatTimestamp(timestamp: number): string {
// Both have timestamp, sort by timestamp descending
return b.timestamp - a.timestamp;
} else if (a.timestamp) {
// Only `a` has timestamp, it comes first
return -1;
} else if (b.timestamp) {
// Only `b` has timestamp, it comes first
return 1;
} else {
// Neither has timestamp, sort alphabetically by groupName
return a.groupName.localeCompare(b.groupName);
// Neither has timestamp, sort alphabetically by groupName (with fallback)
const nameA = a.groupName || '';
const nameB = b.groupName || '';
return nameA.localeCompare(nameB);
}
});
}
}