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, cannot entry 00 for time entry #26409

Closed
4 of 7 tasks
iStoha opened this issue Dec 5, 2022 · 6 comments · Fixed by #26423
Closed
4 of 7 tasks

bug: datetime, cannot entry 00 for time entry #26409

iStoha opened this issue Dec 5, 2022 · 6 comments · Fixed by #26423
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@iStoha
Copy link

iStoha commented Dec 5, 2022

Prerequisites

Ionic Framework Version

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

Current Behavior

When clicking on time picker trying to change time a number keypad opens on mobile phone but you can change the hour value to everything but 00 for some reason. I can change minutes to 00 for some of the times.

image

Untitled.mp4

Expected Behavior

00 shoud be an expected value for hour or minutes field when entering via a keypad just like any other numbers.
for e.g 00:00 ( Not alllowed via keypad. )

Steps to Reproduce

Steps to Reproduce

Android

  • Use ion-datetime and generate the apk using cordova.
  • Click on the hour column or minute column to open the numeric keyboard in phone.
  • Enter 00 from keypad and the value is not accepted while other numbers can be entered.

You can observe the same behaviour on browsers using the keyboard.

https://angular-yxrjrr.stackblitz.io

Code Reproduction URL

https://github.com/iStoha/time-picker

Ionic Info

Ionic:

Ionic CLI : 5.4.13
Ionic Framework : @ionic/angular 13.2.2
@angular-devkit/build-angular : 13.2.2
@angular-devkit/schematics : 13.2.2
@angular/cli : 13.2.2
@ionic/angular-toolkit : 6.0.0

Cordova:

Cordova CLI : 11.0.0
Cordova Platforms : android 9.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard , cordova-plugin-ionic-webview (and other plugins)

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Dec 5, 2022
@iStoha iStoha changed the title bug: Can't enter 00 for hour or minutes in ion-datetime via keypad in mobile devices or in browsers. bug: Can't enter 00 for hour or minutes in ion-datetime via keypad in mobile devices. Dec 5, 2022
@liamdebeasi liamdebeasi self-assigned this Dec 6, 2022
@liamdebeasi liamdebeasi changed the title bug: Can't enter 00 for hour or minutes in ion-datetime via keypad in mobile devices. bug: datetime, cannot entry 00 for time entry Dec 6, 2022
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Dec 6, 2022
@ionitron-bot ionitron-bot bot removed the triage label Dec 6, 2022
@liamdebeasi
Copy link
Contributor

Thanks for the report. I can reproduce this behavior. We use a regex to clean up the wheel picker values when trying to best match your keyboard entry to an item in the wheel. The regex does this by stripping out leading zeros. This allows you to type '2' and get '02' selected without having to type the leading zero. This regex had a flaw where it stripped all leading zeros from a string, including when the string was only zeros (i.e '00'). As a result, your entry of '0' never matched '00'.

I fixed this by having the regex allow at least one 0 when the string it was processing was all zeros. As a result, '00' becomes '0' and will now match your keyboard entry of '0'.

Here is a dev build if you would like to test the proposed fix:

6.3.10-dev.11670337426.126ffd2c

@liamdebeasi liamdebeasi removed their assignment Dec 6, 2022
@iStoha
Copy link
Author

iStoha commented Dec 7, 2022

@liamdebeasi I am sorry if i sound out of depth here.
How would i go about testing this dev build 6.3.10-dev.11670337426.126ffd2c ?
Where can i find it?

@liamdebeasi
Copy link
Contributor

No worries, I should have provided more instructions. That dev build points to a pre-release version of Ionic on npm that contains the fix for this issue. You can run the following command to install it:

npm install @ionic/[email protected]

(This dev build also works for other packages such as @ionic/react too)

@iStoha
Copy link
Author

iStoha commented Dec 7, 2022

Hi @liamdebeasi
I just tested. It is working now. Thanks a lot!

@liamdebeasi
Copy link
Contributor

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

@ionitron-bot
Copy link

ionitron-bot bot commented Jan 6, 2023

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 Jan 6, 2023
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

Successfully merging a pull request may close this issue.

2 participants