Skip to content

Commit

Permalink
fix: filter out next legs too far in the future
Browse files Browse the repository at this point in the history
  • Loading branch information
tekoiv committed Sep 19, 2023
1 parent 2c92c9f commit 9a5eee7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/component/TransitLeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ class TransitLeg extends React.Component {
}

// Some next legs might be for example 24h in the future which seems confusing. Only show alternatives that are less than 12h in the future.
filterNextLegs = leg =>
leg.nextLegs.filter(
filterNextLegs = leg => {
if (!leg.nextLegs) {
return [];
}
return leg.nextLegs.filter(
nextLeg =>
moment(nextLeg.startTime).diff(moment(leg.startTime), 'hours') < 12,
);
};

stopCode = stopCode => stopCode && <StopCode code={stopCode} />;

Expand Down

0 comments on commit 9a5eee7

Please sign in to comment.