Strip dashes from date when building flight-details URL

The API returns flight.flightId.date as 'yyyy-MM-dd' (dashed). Our URL
builder pasted it verbatim, producing /onlineboard/SU6162-2026-04-18
which the route parser (expecting yyyyMMdd) rejected. Normalise the
date to compact form inside buildFlightUrlParams so the URL always
matches the route pattern, regardless of whether the caller passes a
compact or dashed date.
This commit is contained in:
2026-04-18 15:41:14 +03:00
parent 76f7acb0dd
commit ceeae1a7b1
+6 -1
View File
@@ -130,7 +130,12 @@ export function buildFlightUrlParams(id: IParsedFlightId): string {
// Angular truncation: take last 5 chars of (number + suffix) to cap length
const combined = `${paddedNumber}${suffix}`.slice(-5);
return `${id.carrier}${combined}-${id.date}`;
// The flight's API date may arrive dashed (yyyy-MM-dd from real payloads)
// or compact (yyyyMMdd from our own URL parser). Normalise to compact so
// the resulting URL always matches the route pattern.
const compactDate = id.date.replace(/-/g, "");
return `${id.carrier}${combined}-${compactDate}`;
}
/**