diff --git a/app/component/itinerary/PlanConnection.js b/app/component/itinerary/PlanConnection.js index 8cff4082c8..6fb4afe5fb 100644 --- a/app/component/itinerary/PlanConnection.js +++ b/app/component/itinerary/PlanConnection.js @@ -133,6 +133,7 @@ const planConnection = graphql` gtfsId } scheduledDeparture + serviceDay } stoptimes { stop { diff --git a/app/component/itinerary/navigator/NaviUtils.js b/app/component/itinerary/navigator/NaviUtils.js index 49eb06fcd9..a21da09687 100644 --- a/app/component/itinerary/navigator/NaviUtils.js +++ b/app/component/itinerary/navigator/NaviUtils.js @@ -231,7 +231,14 @@ export const getTransitLegState = (leg, intl, messages, time) => { ); severity = 'WARNING'; - } else if (!isRealTime && legTime(start) - time < DISPLAY_MESSAGE_THRESHOLD) { + } else if (!isRealTime) { + const departure = leg.trip.stoptimesForDate[0]; + const departed = + 1000 * (departure.serviceDay + departure.scheduledDeparture); + if (time - departed < DISPLAY_MESSAGE_THRESHOLD) { + // vehicle just departed, maybe no realtime yet + return []; + } severity = 'WARNING'; content = (
@@ -246,7 +253,7 @@ export const getTransitLegState = (leg, intl, messages, time) => { />
); - } else if (isRealTime) { + } else { const { parentStation, name } = from.stop; const stopOrStation = parentStation ? intl.formatMessage({ id: 'from-station' })