From e3a8756f61197692da44aea0ed6d55c1b938acca Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Fri, 18 Oct 2024 16:19:10 -0400 Subject: [PATCH] fallback to departure time when `useArrivalTime` is true --- lib/util/viewer.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/util/viewer.js b/lib/util/viewer.js index d407b356c..e5bcd85a2 100644 --- a/lib/util/viewer.js +++ b/lib/util/viewer.js @@ -21,13 +21,15 @@ export function getSecondsUntilDeparture( ) { let time if (useSchedule) { - time = useArrivalTime - ? stopTime.scheduledArrival - : stopTime.scheduledDeparture + time = + useArrivalTime && !!stopTime.scheduledArrival + ? stopTime.scheduledArrival + : stopTime.scheduledDeparture } else { - time = useArrivalTime - ? stopTime.realtimeArrival - : stopTime.realtimeDeparture + time = + useArrivalTime && !!stopTime.realtimeArrival + ? stopTime.realtimeArrival + : stopTime.realtimeDeparture } return time + stopTime.serviceDay - Date.now() / 1000