This repository was archived by the owner on Feb 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
apps/ui/pages/reservation-unit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -454,9 +454,13 @@ const ReservationUnit = ({
454454
455455 const durationOptions = getDurationOptions ( reservationUnit , t ) ;
456456
457+ // technically these can be left empty (backend allows it)
457458 const minReservationDurationMinutes = reservationUnit . minReservationDuration
458459 ? reservationUnit . minReservationDuration / 60
459460 : 30 ;
461+ const maxReservationDurationMinutes = reservationUnit . maxReservationDuration
462+ ? reservationUnit . maxReservationDuration / 60
463+ : Number . MAX_SAFE_INTEGER ;
460464
461465 const searchUIDate = fromUIDate ( searchDate ?? "" ) ;
462466 // TODO should be the first reservable day (the reservableTimeSpans logic is too complex and needs refactoring)
@@ -468,7 +472,10 @@ const ReservationUnit = ({
468472 searchUIDate != null && isValidDate ( searchUIDate )
469473 ? searchDate ?? ""
470474 : defaultDateString ,
471- duration : Math . max ( searchDuration ?? 0 , minReservationDurationMinutes ) ,
475+ duration : Math . min (
476+ Math . max ( searchDuration ?? 0 , minReservationDurationMinutes ) ,
477+ maxReservationDurationMinutes
478+ ) ,
472479 time : searchTime ?? getTimeString ( defaultDate ) ,
473480 } ;
474481
You can’t perform that action at this time.
0 commit comments