Skip to content

Commit

Permalink
Merge pull request #174 from Vincit/feature/custom-duration-filter-sa…
Browse files Browse the repository at this point in the history
…nity-check

Updated custom duration input to prevent negative numbers. Now update…
  • Loading branch information
JBergVincit committed Jul 11, 2024
2 parents 76c7a73 + a4ebeb8 commit f639018
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/components/BookingView/FilteringDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ const FilteringDrawer = (props: Props) => {
const handleCustomDuration = (
event: React.ChangeEvent<HTMLInputElement>
) => {
const value = event.target.value;

if (!isNaN(parseInt(value)) && typeof value === 'string') {
setDuration(parseInt(value));
onChange(parseInt(value));
let value = parseInt(event.target.value);
if (!isNaN(value)) {
value = Math.max(0, value);
setDuration(value);
onChange(value);
} else {
setDuration(NaN);
}
Expand Down

0 comments on commit f639018

Please sign in to comment.