Skip to content

Commit

Permalink
Merge pull request #1294 from opentripplanner/fix-nan-with-usearrival…
Browse files Browse the repository at this point in the history
…time-true

fallback to departure time when `useArrivalTime` is true
  • Loading branch information
miles-grant-ibigroup authored Nov 1, 2024
2 parents f3866d2 + 5781275 commit 0ceaa2e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/util/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0ceaa2e

Please sign in to comment.