From ceeae1a7b192a75c7d5fb03aeeadecf1dad2c8f4 Mon Sep 17 00:00:00 2001 From: gnezim Date: Sat, 18 Apr 2026 15:41:14 +0300 Subject: [PATCH] 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. --- src/features/online-board/url.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/features/online-board/url.ts b/src/features/online-board/url.ts index 47fb6f30..c4010832 100644 --- a/src/features/online-board/url.ts +++ b/src/features/online-board/url.ts @@ -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}`; } /**