I hit a recent problem where I'm validating dates to make sure a start date is not greater than an end date. The dates entered are start: 3/13/2022 02:30 end: 3/13/2022 03:15
When I convert these to dates in my code an extra hour is applied to the start date making it 03:30.The end date converts as expected and remained 03:30. Because of this my validation is getting hit and we see an error stating "start date cannot be greater than end date".
Am I missing something or how do I prevent this hour from being added?
I've tried changing the format of the date, but that didn't seem to make a difference.
I think it depends on your system's local timezone, to compare those two dates, have you tried to convert them to timestamp ?
Maybe you could log the dates to the console using the date.toISOString() to see what they look like when converted to utc+0