ionChange not being called for V6 ion-datetime

Hi, I am working with the version 6 date time, and I have found that, at least with my setup, that ionChange is not being called. It did actually seem to be called once or twice , but most of the time, it is not. And when I did have it being called (in my actual application), it was on;y if I updated the date, and not just the time.

But, in a simple test app (see below), it never seems to be called.

I have the following in a new blank ionic V6 application just created…

 <ion-content>     
      <ion-item>
        <ion-label>Start Time</ion-label>
        <ion-note slot="end" id="datetimeValue">{{dateTime}}</ion-note>
        <ion-modal trigger="datetimeValue" show-backdrop="true">
          <ng-template>              
            <ion-datetime
              showDefaultButtons="true"
              size="cover"
              id="datetime"                  
              min="1989-06-04"
              max="2004-08-23"
              value="1994-12-15T13:47:20.789">
              (ionChange)="dateTimeUpdated($event)"
            </ion-datetime>            
        </ng-template>
        </ion-modal>
      </ion-item>    
</ion-content>

And in the component code…

export class HomePage {

  public dateTime: string;
  constructor() {
    this.dateTime = new Date().toDateString();
  }

  public dateTimeUpdated(ev: any): void {
    try {
     const neVal =  ev.detail.value;
     console.log(neVal);
    } catch (error) {
      console.error(error);
    }
  }
}

an the handlder dateTimeUpdated is never called.

Is there anything else I need to do, to get this called, or is there some other way I can get the updated value?

Thanks in advance

(ionChange)=“dateTimeUpdated($event)”

seems to be outside the tag

try to write

         <ion-datetime
              showDefaultButtons="true"
              size="cover"
              id="datetime"                  
              min="1989-06-04"
              max="2004-08-23"
              value="1994-12-15T13:47:20.789"
              (ionChange)="dateTimeUpdated($event)">

            </ion-datetime>  
1 Like

Ah, stupid mistake. Thankyou. That was in the example app, in my “app proper” I found that I had forgotten to wire up [(ngModel)], and once I did this, (ionChange) would fire as required.