Issue with toISOString()


#1

Hi i am trying to get tomorrow’s date and i am able to get it in default format
but i need in ISO so i use this function toISOString
This function is returning me day after tomorrow date
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
console.log(tomorrow.toISOString());

Any suggestion how do i fix it?


#2

Don’t get the problem?!
With tomorrow.setDate(tomorrow.getDate() + 1);
you get 1549232287858 and that can be used for a new Date(). Typing on the console new Date(1549232287858) will get Date 2019-02-03T22:18:07.858Z and
that’s the same as:
(new Date(1549232287858)).toISOString()
???