csvalpha/amber-ui

Date one day off

Closed this issue · 2 comments

How to reproduce

  1. Go to an edit page with a date field
  2. Enter a date

Expected behaviour

The entered date is saved

Current behaviour

Sometimes, the saved date is off by one day

It looks like, with a date field, the date is parsed in the local timezone but sent to the server in UTC. So 05-12-2022 00:00 UTC+2 becomes 04-12-2022 22:00 UTC, which is then saved as 04-12-2022.

So 05-12-2022 00:00 UTC+2 becomes 04-12-2022 22:00 UTC, which is then saved as 04-12-2022.

What does it mean for it to 'be saved as 04-12-2022' ? Does that mean that it is changed by the backend from 04-12-2022 22:00 to 04-12-2022 00:00 ? Shouldn't we be able to simply save it as 04-12-2022 22:00, which then translates via displaying with respect for locale to 05-12-2022 00:00 again?