Describe the problem
Passing the time prop to the <TimePicker> does not trigger a check for validity. The check for validity is only triggered on select or on input change or on blur.
How do you reproduce the problem?
The time picker is in a valid state in the following scenario without any user interaction:
<TimePicker
time="9:00 abc"
/>
Expected behavior
I expect the state of isInvalid to be changed according to the value of the time passed to the time picker.
Is this issue blocking you?
Kind of. I was able to do this workaround
useEffect(() => {
ref.current.setState({ isInvalid: isInvalid(props.time), timeState: props.time});
}, [props.time]);
but it's not a good idea because I'm directly setting the timeState state variable instead of going through the logic of parseTime from TimePickerUtils
What is your environment?
- OS: Windows
- Browser: Chrome
- Version: 105.0.5195.102