Skip to content

bug: Setting the value of ion-datetime with presentation time, results in multiple ionChange emissions and incorrect display #24967

@CSHaze

Description

@CSHaze

Prerequisites

Ionic Framework Version

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

Current Behavior

When patching a form value (connected to ion-dateTime) using an asynchronous action, the hours part of the control changes incorrectly.

Expected Behavior

I would expect the patchValue to change the time control to show the new, correct hour value.

Steps to Reproduce

Add an ion-DateTime control to the html using a "time" presentation.

Create a dynamic form in the component using a formBuilder.

Connect the form to ion-DateTime control.

Use an asynchronous action to trigger a patchValue to the form Value tied to the ion-DateTime control.

Observe that the minutes change to the correct value and the hours do not.

Code Reproduction URL

https://stackblitz.com/edit/ionic6-angular13-pegslx?file=src/app/app.component.ts

Ionic Info

Ionic:

Ionic CLI : 6.12.4 (...\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.0.11
@angular-devkit/build-angular : 13.2.5
@angular-devkit/schematics : 13.2.5
@angular/cli : 13.2.5
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 3.4.1
@capacitor/core : 3.4.1

Utility:

cordova-res : not installed
native-run : 1.5.0

System:

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

Additional Information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions