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: datetime max and min do not consider time when showDefaultButtons={true} #26146

Closed
4 of 7 tasks
Facj opened this issue Oct 17, 2022 · 6 comments
Closed
4 of 7 tasks
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@Facj
Copy link

Facj commented Oct 17, 2022

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

If option showDefaultButtons={true} is included in IonDatetime, attributes max and min stop working correctly.
Only date is considered, time is not taking into account to set min and max selectable values.

If option showDefaultButtons={true} is commented out, attributes max and min work fine for date and time.

Expected Behavior

Attributtes min and max of IonDatetime should work correctly when option showDefaultButtons={true} is included.

Steps to Reproduce

  1. Load page in Codesandbox
  2. Select Birth Time
  3. When the modal opens, check that all times are selected all available days even though max and min atrributes impose time restrictions.

Comment out line showDefaultButtons={true} (line 48) and repeat the steps above.
Time restrictions imposed by max and min attributes are now working fine.

Code Reproduction URL

https://codesandbox.io/s/ionic6-datetime-and-react-hook-form-me36n2

Ionic Info

ionic info

Ionic:

Ionic CLI : 6.6.0 (C:\Users\MyUser\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/react 6.2.9

Utility:

cordova-res : not installed
native-run : not installed

System:

NodeJS : v16.15.1 (C:\Program Files\nodejs\node.exe)
npm : 8.12.2
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Oct 17, 2022
@liamdebeasi liamdebeasi self-assigned this Oct 27, 2022
@liamdebeasi
Copy link
Contributor

Thanks for the report and apologies for the delay. Does this issue still happen on the latest version of Ionic (v6.3.3 as of writing)? Also, can you please clarify what the expected behavior is here?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Oct 27, 2022
@liamdebeasi liamdebeasi removed their assignment Oct 27, 2022
@ionitron-bot ionitron-bot bot removed the triage label Oct 27, 2022
@Facj
Copy link
Author

Facj commented Oct 28, 2022

I can confirm that the issue still happens in Ionic 6.3.3. I have updated the Ionic version in the Codesanbox included in my initial post.

The expected behavior is that time values in max and min parameters are correctly considered.

For instance, in the example in the Codesandbox the parameters are the following:

  • min="2022-09-18T12:23"
  • max="2022-10-12T17:22"

Date restriction is correctly applied, I cannot select any day before 2022-09-18 or after 2022-10-21.
However, time restriction is not correctly applied, I can select any time in the limit days, while times before 12:23 should not be allowed in 2022-09-18 and times after 17:22 should not be allowed in 2022-10-12.

This problem does not appear if showDefaultButtons={false}.

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Oct 28, 2022
@liamdebeasi
Copy link
Contributor

Thanks! I can reproduce this behavior.

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Oct 28, 2022
@ionitron-bot ionitron-bot bot removed the triage label Oct 28, 2022
@liamdebeasi
Copy link
Contributor

Hey there,

Here is a dev build with a proposed fix if you are interested in testing it:

6.3.6-dev.11668029832.1cf48a01

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #26257, and a fix will be available in an upcoming release of Ionic Framework. Please feel free to continue testing the dev build, and let me know if you run into any issues.

@ionitron-bot
Copy link

ionitron-bot bot commented Dec 14, 2022

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 Dec 14, 2022
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