-3

Json result goes wrong

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

Please find the application here https://stackblitz.com/edit/angular-eavwul?file=app%2Fdatepicker-overview-example.ts

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
shizil
  • 37
  • 2
  • 11
  • 1
    This is due to the different timezone, see https://stackoverflow.com/questions/1486476/json-stringify-changes-time-of-date-because-of-utc https://stackoverflow.com/questions/31096130/how-to-json-stringify-a-javascript-date-and-preserve-timezone/31104671 – Samuel Vaillant Feb 06 '19 at 12:35

1 Answers1

1

One Date is UTC and the other GMT+0400.

kolmio23
  • 11
  • 1
  • 4