time = new Date();
timeEntered1 = new Date();
getTime() {
console.log(this.timeEntered1);
console.log(this.time);
console.log(this.timeEntered1.getTime());
console.log(this.time.getTime());
}
for console.log(this.time.getTime()); I got an error which "is TypeError: this.timeEntered1.getTime is not a function".
time is a simple Date() variable and timeEntered1 is a Date() which the user enter in my html code, and I got it using two way binding. So I do not get why I can use .getTime with time and why I can not with timeEntered1 since they are both a Date().
Here is my html code
<ion-content padding>
<ion-datetime
displayFormat="HH:mm"
[(ngModel)]='timeEntered1'
picker-format="HH:mm"
>
Choose time: </ion-datetime>
<ion-button (click)="getTime()">Pick Time</ion-button>
</ion-content>