History: day navigation shows the wrong date / off-by-one (and off-by-two) until page refresh
Reported by @marmof in #16 (split out into a dedicated issue).
Problem
In the History section the date navigation is misaligned with the data being shown:
- On open, the current day is shown (e.g.
08/06). - Stepping back one day does not show
07/06data — it shows05/06data while the label reads06/06. - Stepping forward again to the current day shows
07/06data while the label reads08/06. - Only after a page refresh does the correct value for today appear again.
So both the displayed date label and the loaded data set are off, and the state only recovers after a full reload.
Affected version
LeapConnect 0.8.2
Expected behavior
The date label and the loaded data must always stay in sync, and navigating back/forward must load the correct adjacent day without requiring a page refresh.
Ok, this is the issue. The day-stepper built the request date with toISOString() (UTC) while the label used the local date, so at UTC+ offsets (Italy) it fetched the previous day. Refresh masked it because the default view uses a relative days=1 query.
Fixed: date ranges are now serialized from the local date, plus a guard so a slow response can't overwrite a newer navigation. Ships in the next release v0.11.0.