Skip to content

Commit

Permalink
fix: handle if selected date was undefined while double click on a sa… (
Browse files Browse the repository at this point in the history
#1373)

Handle a negative case if the selected date was undefined while
double-clicking on the same date in the calendar on the demo website.

![Screenshot 2024-06-12 at 15 45
49](https://github.com/maplibre/martin/assets/18734643/9d5afd46-f7a4-434e-ba44-925613055627)
  • Loading branch information
jokopriyono authored Jun 13, 2024
1 parent bb953be commit a0dc75e
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions demo/frontend/src/Components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,22 @@ class Map extends PureComponent<{}, {visibleLayer: any, range: any, hour: any}>
};

changeFilter = (filter: string, value: any) => {
this.setState(state => ({
...state,
[filter]: value
}));
if (filter !== undefined && value !== undefined) {
this.setState(state => ({
...state,
[filter]: value
}));
}
};

getQueryParams = () => {
const { range: { from, to }, hour } = this.state;

const dateFrom = `${dateConverter(from)}.2017`;
const dateTo = `${dateConverter(to)}.2017`;
let dateTo = `${dateConverter(to)}.2017`;
if (to === undefined) {
dateTo = dateFrom;
}

return encodeURI(`date_from=${dateFrom}&date_to=${dateTo}&hour=${hour}`);
};
Expand Down

0 comments on commit a0dc75e

Please sign in to comment.