I get a date in string format that I use to create a new Date().
let date_str = '2019-09-08';
let date = new Date(date_str);
console.log(date);
When printed, instead of being 2019-09-08T00:00:00.000Z
as expected, it seems that the date is converted to my timezone, and the console prints Sat Sep 07 2019 20:00:00 GMT-0400
, which essentially changes the date and there functionality I need.
What is causing this and how can I get around this?
Note: I tried running the above code as a code snippet in this post, but got 2019-09-08T00:00:00.000Z
instead of the erroneous date...