Ionic DateTime component displaying day name as 'undefined'

#1

My DateTime component is displaying my day-name as undefined:

HTML

 <span class="time">
            <ion-datetime placeholder="00" displayFormat='mm' picker-format="mm" [(ngModel)]="time"></ion-datetime>
 </span>

Code

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  
time;
alert(this.time);
  }

Anybody know why ? Thanks

#2

Maybe because you haven’t bothered to initialize time?

#3

ionic v4? if yes, may be solve in next beta. I saw something that datetime had a bug in current beta which is solved now in master branch I think

#4

yes… in ionic v3 i try set time as “new Date(0);” and it work but in V4 it isn’t work… basicaly when i change picker, value in time isn’t change

#5

<ion-datetime> wants ISO8601 strings, not Date objects.

#6

sorry, my fault, it is new Date().toISOString(); but in v4 it isn’t work

#7

Ok Ionic v4, so it’s probably what I meant. Maybe fixed in next beta, see https://github.com/ionic-team/ionic/issues/14988