vr_date :Date
alert(this.vr_date ) // Result Shows Thu Feb 07 2019 00:00:00 GMT+0400
var json = JSON.stringify(this.vr_date);
alert(json); // Result Shows 2019-02-06T20:00:00.000Z see the date goes wrong
the output day shows 06 instead of 07
my html
<input matInput
[(ngModel)]="vr_date"
name="vr_date"
[matDatepicker]="myDatepicker"
matInput
placeholder="Vr Date"
[readonly]="true" >
<mat-datepicker-toggle matSuffix [for]="myDatepicker" ></mat-datepicker-toggle>
<mat-datepicker #myDatepicker></mat-datepicker>
i sloved using this this.vr_date.setHours(this.vr_date.getHours() - this.vr_date.getTimezoneOffset() / 60);
Looks like the timezone is different. In the first alert, you get day 07, time 00:00 with GMT +4. In the second alert, you get the definition of the date object, (stored in GMT format). Now, if you substract those +4 hours from the first alert, you get the second alert: day: 06, time 20:00.