A component in our app allows the user to input their birthdate and then, later, display it again. It works for most cases, but there is a problem for some use cases, I suspect because of Daylight Savings Time.
I am sending the date to the backend in ISO format (UTC time) and receiving it also in ISO format, but with relative time. Example (8. 8. 2000):
sending: 2000-08-07T22:00:00.000Z
receiving: 2000-08-08T00:00:00+02:00
For some dates, the returned date is one day lower. Example (8. 8. 1977, becomes 7. 8. 1977):
sending: 1977-08-07T23:00:00.000Z
receiving: 1977-08-08T00:00:00+02:00
I have a theory that it's because the client and server use different locales - which have historically observed DST differently. I am based in the Czech Republic, and the country hasn't observed DST in 1977.
How can I fix this problem? If my theory is correct, how do I find out what locales are being used and how do I set the frontend/client one?
Thanks in advance!