Answer the question
In order to leave comments, you need to log in
How to handle date change due to timezone?
On the front there is a date picker control. js doesn't have a date-only type, and it returns a Date including the tyzone, the date is non-empty, and the time is 00:00.
When the time arrives at the server and is parsed into a pure date object, then yesterday's date is stored in the database due to UTC.
What to do?
Do you need to make your own type to store only the date in js?
Add 12 hours on the server to avoid changing the date from the time zone?
Answer the question
In order to leave comments, you need to log in
You need to store a timezone on the client, but you can convert it like this https://stackoverflow.com/questions/10087819/conve...
In general, it's better to work everywhere in utc, and show with conversion to local.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question