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
Maybe because you haven’t bothered to initialize time
?
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
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
<ion-datetime>
wants ISO8601 strings, not Date
objects.
sorry, my fault, it is new Date().toISOString(); but in v4 it isn’t work
Ok Ionic v4, so it’s probably what I meant. Maybe fixed in next beta, see https://github.com/ionic-team/ionic/issues/14988