ionic-framework
ionic-framework copied to clipboard
bug: datetime, current minutes shown even if not included in minuteValue field
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- [ ] v4.x
- [ ] v5.x
- [X] v6.x
Current Behavior
When using the ion-datetime component for time selection with minuteValue set, eg. to [0,15,30,45] and without an initial value, the current time is preselected. But if the time is 10:20 for example, the preselected minute is "00". Pressing the "Done" button of the time selector without changing the minute, will set the value to "10:20" - the current time. This does not correspond to the displayed value of the selector. To set a time of "11:00", the user has to change the hour value and also the minute value to any different than "00" and back to "00".
Expected Behavior
If the user confirms the current selection, the current shown value of the selector should be provided by the time selector as new value. And not a minutes value which the user has never selected or even seen.
Steps to Reproduce
- Setup an ion-datetime component for time selection only
- Enable the default buttons to display the "Done" button
- Set minuteValue, eg. to "0,15,30,45"
- Provide no initial value
- Open the time selector and confirm the selected time via the "Done" button
- The provided time value is the current time but not "00" as minutes as selected
Code Reproduction URL
https://github.com/mstichweh/ion-datetime-minutevalues-bug.git
Ionic Info
Ionic:
Ionic CLI : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.0.5 @angular-devkit/build-angular : 13.0.4 @angular-devkit/schematics : 13.0.4 @angular/cli : 13.0.4 @ionic/angular-toolkit : 5.0.3
Utility:
cordova-res : not installed globally native-run (update available: 1.5.0) : 0.3.0
System:
NodeJS : v14.18.2 (/usr/local/bin/node) npm : 7.24.2 OS : macOS Big Sur
Additional Information
No response
@mstichweh thanks for reporting this issue.
I believe in instances where the developer passes minuteValue to filter the selection, we should likely ignore the current time and default to the lowest bounds of the minuteValue, in this case: 10:00.
The user should definitely not be able to confirm a time value that is inconsistent with the filtered time selections.
We will capture this as a bug and prioritize. Thanks!
Thanks for the issue. Here is a dev build if you are interested in testing the proposed fix.
npm install @ionic/[email protected]
Please note that there is an existing bug where the wheel picker does not update the value property of datetime when using a default value. That is being tracked in https://github.com/ionic-team/ionic-framework/issues/25839.
Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/26093, and a fix will be available in an upcoming release of Ionic Framework.
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.