Skip to content

Commit

Permalink
fix: add date to departures search
Browse files Browse the repository at this point in the history
  • Loading branch information
adriansberg committed Nov 12, 2023
1 parent 237a12c commit 051fce9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/page-modules/departures/server/journey-planner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {

export type DepartureInput = {
id: string;
date: number | null;
transportModes: TransportModeFilterOption[] | null;
};
export type { DepartureData, Quay, Departure };
Expand Down Expand Up @@ -87,7 +88,9 @@ export function createJourneyApi(
query: StopPlaceQuayDeparturesDocument,
variables: {
id: input.id,
startTime: new Date(),
startTime: input.date
? new Date(input.date).toISOString()
: new Date().toISOString(),
numberOfDepartures: 10,
transportModes: getTransportModesEnums(input.transportModes),
},
Expand Down
1 change: 1 addition & 0 deletions src/pages/departures/[[...id]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const getServerSideProps = withGlobalData(
if (id && stopPlace) {
const departures = await client.departures({
id,
date: searchTime.mode !== 'now' ? searchTime.dateTime : null,
transportModes: transportModeFilter,
});

Expand Down

0 comments on commit 051fce9

Please sign in to comment.