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