File tree 1 file changed +9
-2
lines changed
packages/features/schedules/components
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -408,9 +408,15 @@ const TimeRangeField = ({
408
408
isDisabled = { disabled }
409
409
value = { value . start }
410
410
menuPlacement = "bottom"
411
- max = { value . end }
412
411
onChange = { ( option ) => {
413
- onChange ( { ...value , start : new Date ( option ?. value as number ) } ) ;
412
+ const newStart = new Date ( option ?. value as number ) ;
413
+ if ( newStart >= new Date ( value . end ) ) {
414
+ const newEnd = new Date ( option ?. value as number ) ;
415
+ newEnd . setMinutes ( newEnd . getMinutes ( ) + INCREMENT ) ;
416
+ onChange ( { ...value , start : newStart , end : newEnd } ) ;
417
+ } else {
418
+ onChange ( { ...value , start : newStart } ) ;
419
+ }
414
420
handleSubmit && handleSubmit ( getValues ( ) as AvailabilityFormValues ) ;
415
421
} }
416
422
/>
@@ -457,6 +463,7 @@ const LazySelect = ({
457
463
onMenuOpen = { ( ) => {
458
464
if ( min ) filter ( { offset : min } ) ;
459
465
if ( max ) filter ( { limit : max } ) ;
466
+ if ( ! min && ! max ) filter ( { offset : 0 , limit : 0 } ) ;
460
467
} }
461
468
menuPlacement = { menuPlacement }
462
469
value = { options . find ( ( option ) => option . value === dayjs ( value ) . toDate ( ) . valueOf ( ) ) }
You can’t perform that action at this time.
0 commit comments