Bugfixing

This commit is contained in:
Michal Kváček
2023-11-20 10:24:08 +01:00
parent f9d70a5d57
commit af74801693
12 changed files with 20 additions and 29 deletions
+13
View File
@@ -0,0 +1,13 @@
import {FORMAT_DATE, formatDatetime} from "src/composables/datetimeUtils";
export const flightName = (flight) => {
const date = formatDatetime(flight.takeoffDatetime, FORMAT_DATE);
if (flight.name !== '') {
return `${flight.name} (${date})`
} else {
const track = flight.track ? flight.track.map(t => t.pointOfInterest?.name || t.airport?.icaoCode) : [];
const trackStr = track.length > 0 ? ` - ${track.join(" - ")} - ` : ' - ';
return `${flight.takeoffAirport.icaoCode} ${trackStr} ${flight.landingAirport.icaoCode} (${date})`;
}
}