Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: IonDateTime internal state breaks if navigating out of range #23939

Closed
4 of 6 tasks
janrg opened this issue Sep 15, 2021 · 6 comments
Closed
4 of 6 tasks

bug: IonDateTime internal state breaks if navigating out of range #23939

janrg opened this issue Sep 15, 2021 · 6 comments
Labels
package: core @ionic/core package type: bug a confirmed bug report
Milestone

Comments

@janrg
Copy link

janrg commented Sep 15, 2021

Prequisites

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

@ionitron-bot ionitron-bot bot added the triage label Sep 15, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Sep 15, 2021
@ionitron-bot ionitron-bot bot removed the triage label Sep 15, 2021
@liamdebeasi liamdebeasi added this to the 6.0.0-beta.7 milestone Sep 15, 2021
@janrg
Copy link
Author

janrg commented Sep 15, 2021

Oh wow, that was incredibly quick. Thank you :-)

@liamdebeasi
Copy link
Contributor

Thanks for the issue. I put up a PR in #23940 and have included a dev build below if you are interested in testing it in your app:

npm install @ionic/[email protected] @ionic/[email protected]

@janrg
Copy link
Author

janrg commented Sep 15, 2021

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?

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Sep 15, 2021

Glad the issue is resolved!

Currently you cannot type into the time container, but we are adding that functionality soon!

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23940, and a fix will be available in an upcoming release of the Ionic v6 beta.

@ionitron-bot
Copy link

ionitron-bot bot commented Oct 16, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

2 participants