Answer the question
In order to leave comments, you need to log in
`
How to convert dates correctly?
Hello.
I have a dynamic string like:
const dateString = `${formattedCurrentDate} ${timeSlot?.startTime}`; -> `2021-10-21 13:30`
const currentTimeSlotDate = new Date(dateString);
console.log(currentTimeSlotDate); -> 2021-10-21T13:30:00.000Z
console.log(new Date("2021-10-21T13:30:00.000Z"))
Thu Oct 21 2021 16:30:00 GMT+0300 (Eastern European Summer Time)
Thu Oct 21 2021 13:30:00 GMT+0300 (Eastern European Summer Time)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question