bug: datetime picker in ion-modal crashes on selecting 12 AM
See original GitHub issuePrerequisites
- 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
- Nightly
Current Behavior
On selecting 12 AM on time picker, current page freezes and crashes.
Expected Behavior
Date picker should close the modal.
Steps to Reproduce
Here is the code in component
<ion-input id="user_time" [value]="inputValue" readonly="true" [placeholder]="'Select Time'"></ion-input>
<ion-modal trigger="user_time" size="cover" alignment="center">
<ng-template>
<ion-content>
<ion-datetime #notificationtime presentation="time" [value]="pickerValue" minuteValues="0"
(ionChange)="timeChange(notificationtime)" [cancelText]="'Cancel'" [doneText]="'OK'" showDefaultButtons="true"
hourCycle="h12"
>
</ion-datetime>
</ion-content>
</ng-template>
</ion-modal>
To handle when value changes
timeChange(event) {
this.pickerValue = event.value;
if (event && event.value) {
let parsedTime = format(parseISO(event.value), 'HH');
this.inputValue = parsedTime ? parsedTime : event.value;
}
}
Code Reproduction URL
https://stackblitz.com/edit/ionic6-angular13-w1sjhk?file=src/app/app.component.ts
Ionic Info
Ionic:
Ionic CLI : 6.18.1 Ionic Framework : @ionic/angular 6.2.0 @angular-devkit/build-angular : 12.2.16 @angular-devkit/schematics : 13.2.6 @angular/cli : 12.2.16 @ionic/angular-toolkit : 2.3.3
Cordova:
Cordova CLI : 11.0.0 Cordova Platforms : android 10.1.2, browser 6.0.0, ios 6.2.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 20 other plugins)
Utility:
cordova-res : not installed globally native-run : not installed globally
System:
Android SDK Tools : 26.1.1 ios-deploy : 1.11.4 ios-sim : 8.0.2 NodeJS : v14.19.0 (/usr/local/bin/node) npm : 6.14.16 OS : macOS Monterey Xcode : Xcode 13.4.1 Build version 13F100
Additional Information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic-framework/pull/25716, and a fix will be available in an upcoming release of Ionic Framework.
@liamdebeasi , the dev build worked without any issue. Thanks.