Release v0.1.22
This commit is contained in:
@@ -541,13 +541,19 @@
|
||||
return (a ?? '').localeCompare(b ?? '', undefined, { sensitivity: 'base' });
|
||||
}
|
||||
|
||||
function compareDate(a: string | null | undefined, b: string | null | undefined) {
|
||||
const aTime = a ? Date.parse(a) : Number.NEGATIVE_INFINITY;
|
||||
const bTime = b ? Date.parse(b) : Number.NEGATIVE_INFINITY;
|
||||
return aTime - bTime;
|
||||
}
|
||||
|
||||
const sortedEntries = $derived.by(() => {
|
||||
const direction = sortDirection === 'asc' ? 1 : -1;
|
||||
return [...entries].sort((a, b) => {
|
||||
let result = 0;
|
||||
|
||||
if (sortKey === 'date') {
|
||||
result = compareText(a.production_date, b.production_date);
|
||||
result = compareDate(a.production_date, b.production_date);
|
||||
} else if (sortKey === 'product') {
|
||||
result = compareText(a.product_name_snapshot, b.product_name_snapshot);
|
||||
} else if (sortKey === 'packed') {
|
||||
@@ -565,6 +571,10 @@
|
||||
result = compareText(a.notes, b.notes);
|
||||
}
|
||||
|
||||
if (result === 0) {
|
||||
result = (a.id ?? 0) - (b.id ?? 0);
|
||||
}
|
||||
|
||||
return result * direction;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user