When creating dates from strings on the client side, if you use "-" as a separator (as in "2023-8-20" it seems to set the date to yesterday
> let x = new Date("2023-08-20"), y = new Date("2023/08/20")
undefined
> x
Sat Aug 19 2023 20:00:00 GMT-0400 (Eastern Daylight Time)
> y
Sun Aug 20 2023 00:00:00 GMT-0400 (Eastern Daylight Time)
It also works fine if you do something like "2023, 08, 20" instead. I understand I could use
<Date>.getTimezoneOffset()
and add it to the hours of x
to get it normal, but why does this happen?
This is not an issue on the server side from what I've tested so far.