'Disabling minutes in certain hours in MUI time picker, reactjs

Is it possible in MUI to disable some minutes in certain time in MUI time picker? for example, I want to disable minute 30 in hour 5 only. The user should not be able to select the time 5:30, but should be able to select 30th minute of rest of the hours like 3:30, 4:30 ...etc.



Solution 1:[1]

Not sure what your onChange() handler is like but you may be able to utilize a very simple regex given how specific your use-case is.

For example;

const [date, setDate] = useState('');

const onChange = value => {
   const regex = new RegExp('5:30');
   
   if (!regex.test(value)) setDate(value);
}

return <DateTimePicker onChange={onChange} value={date} />;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dabyland