I am getting one error when try to get difference two dates.
I am getting expires date from backend. This is give me this Date- 2022-09-15T17:00:00.000+00:00
Now I have to difference this date to now date.
I try it i this way-
const expires = new Date("2022-09-15T17:00:00.000+00:00");
const now = new Date();
const expiryTimestamp = new Date((+expires - +now) / (1000 * 60 * 60 * 24))
console.log(expiryTimestamp);
But It is not working. In console I find this -
Thu Jan 01 1970 06:00:00 GMT+0600 (Bangladesh Standard Time)
But Why it print 1970
.
I also try without-
const expires = new Date(flash?.expires);
const now = new Date();
const expiryTimestamp = new Date((+expires - +now)))
console.log(expiryTimestamp);
But not working.