Skip to content

Commit

Permalink
Updated custom duration input to prevent negative numbers. Now update…
Browse files Browse the repository at this point in the history
…s the value to the minimum allowed duration instead in case of negative input.
  • Loading branch information
JBergVincit committed Jul 8, 2024
1 parent 34073c7 commit a4ebeb8
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 a4ebeb8

Please sign in to comment.