Bugfixing

This commit is contained in:
Michal Kváček
2023-08-29 21:28:29 +02:00
parent dd248d4432
commit ab1e20e6eb
7 changed files with 25 additions and 13 deletions
+4 -2
View File
@@ -6,9 +6,11 @@ export const FORMAT_DATE = "DD. MM. YYYY";
export const FORMAT_TIME = "HH:mm"
export const minutesToHumanReadable = (totalMinutes) => {
const hours = Math.round(totalMinutes / 60);
const hours = Math.floor(totalMinutes / 60);
const minutes = totalMinutes % 60;
return `${hours}h ${minutes}min`
const hoursPart = hours > 0 ? `${hours}h ` : "";
return `${hoursPart}${minutes}min`
}
export const formatDatetimeNative = (date, format = "DD. MM. YYYY") => {
+4 -1
View File
@@ -10,7 +10,10 @@ export const flightName = (flight) => {
if (flight.name !== '') {
return `${flight.name} (${date})`
} else {
return `${flight.takeoffAirport.icaoCode} - ${flight.takeoffAirport.icaoCode} (${date})`;
const track = flight.track ? flight.track.map(t => t.pointOfInterest.name) : [];
const trackStr = track.length > 0 ? ` - ${track.join(" - ")} - ` : ' - ';
return `${flight.takeoffAirport.icaoCode} ${trackStr} ${flight.landingAirport.icaoCode} (${date})`;
}
}