question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: datetime picker in ion-modal crashes on selecting 12 AM

See original GitHub issue

Prerequisites

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Aug 5, 2022

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.

1reaction
sagun-gautamcommented, Aug 5, 2022

@liamdebeasi , the dev build worked without any issue. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Time picker crashing when changing from AM to PM
When updating time for Calendar, it should be as follows: public void updateChangedTime(int hourOfDay, int minute) { buttonTime.
Read more >
ion-datetime - Ionic Framework
Datetimes present a picker interface to select dates and times. ... Additionally, the hour is always in the 24-hour format, so 00 is...
Read more >
Debugger crashes on DateTimeChanged event
I complete removed dateDTP and let the debugger stop at the OnValueChanged of this new DateTimePicker. But still VS crashes/becomes unresponsive. I am...
Read more >
How to use the Ionic 6 Datetime component - YouTube
In this video we are taking a closer look at the Ionic 6 datetime component and implement a stylish modal that works for...
Read more >
Datepicker iOS 14 crashes on completely empty project
In my project I noticed that date-picker component keeps crashing on a specific dates ... Steps to reproduce the error: ... I am...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found