I'm struggling to generate a Date object with just the date when using 'YYYY-MM-DD' input format.
Here's the code I'm using:
let date1 = new Date('2022-01-06')
let date2 = new Date('01/06/2022')
The results are as follows:
date1 = Wed Jan 05 2022 16:00:00 GMT-0800 (Pacific Standard Time)
date2 = Thu Jan 06 2022 00:00:00 GMT-0800 (Pacific Standard Time)
Despite using the same input for creating a new Date object, I'm getting different times. My data is stored in JSON format as '2022-01-06' and I need the date object to have no time, similar to date2.