💄 Trip table days: order by asc date, asc label

This commit is contained in:
itskovacs 2025-11-05 18:02:23 +01:00
parent 87efc44fa2
commit a6c751198b

View File

@ -386,13 +386,15 @@ export class TripComponent implements AfterViewInit {
.sort((a, b) => { .sort((a, b) => {
const dateA = a.day.dt; const dateA = a.day.dt;
const dateB = b.day.dt; const dateB = b.day.dt;
if (dateA && dateB) return dateA.localeCompare(dateB) || (a.item.time || '').localeCompare(b.item.time || ''); if (dateA !== dateB) {
if (!dateA && !dateB) { if (!dateA) return 1;
return ( if (!dateB) return -1;
(a.day.label || '').localeCompare(b.day.label || '') || (a.item.time || '').localeCompare(b.item.time || '') const dateCompare = dateA.localeCompare(dateB);
); if (dateCompare !== 0) return dateCompare;
} }
return dateA ? -1 : 1; const labelCompare = (a.day.label || '').localeCompare(b.day.label || '');
if (labelCompare !== 0) return labelCompare;
return (a.item.time || '').localeCompare(b.item.time || '');
}) })
.map(({ item, day }) => { .map(({ item, day }) => {
const lat = item.lat ?? item.place?.lat; const lat = item.lat ?? item.place?.lat;