bug: IonDateTime internal state breaks if navigating out of range
See original GitHub issuePrequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
Current Behavior
In the new IonDateTime
component, if I navigate to a month that is outside of the range given by min and max or to a month that is partially outside of the range while the last selected day would be out of range in this month, onIonChange
is triggered with a broken internal state that cannot be recovered. The returned value changes to something like 2022-01-15T19:aN:00-aN:aN
. Selecting a valid date afterwards does not fix this and the time component remains in this broken state.
Tested in ionic react 6.0.0-beta.5
Expected Behavior
onIonChange should not be triggered and the internal state of the component should not break
Steps to Reproduce
<IonDatetime min='2021-09' max='2021-10' onIonChange={(event) => {console.log(event.detail.value)}} />
Use the arrows to navigate to August or November. Observe console output.
Code Reproduction URL
No response
Ionic Info
No response
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Glad the issue is resolved!
Currently you cannot type into the time container, but we are adding that functionality soon!
I have tested it and it looks like it works, thanks! BTW: sorry this is a bit off-topic but is it intended that (at least in the browser) the time can only be changed by arrow up and down and not by typing into it?