Skip to content
Snippets Groups Projects
Commit 7680635c authored by Nicolas Lempereur's avatar Nicolas Lempereur
Browse files

[FIX] web: setDate mixing utc+tz and local date

In the calendar view there is some mixing of moment with:

- a local date with given timezone
- a UTC date with added timezone manually applied

The setDate function of calendar model sometimes received either of the
two types, and always transforms them to UTC date with added timezone.

This cause eg. the following issues:

- in the minicalendar, if we click on a day (eg. 12) the day highlighed
  will be the one of 12th at midnight with timezone applied. So with a
  negative timezone the 11th would be highlighted in the mini calendar
  (but the 12th would still be the day shown).

- if we change scale (week/day/month) or open calendar or use next or
  previous button: we call `setDate` with a UTC+timezone moment. So each
  time this is done, we get an additional timezone

  eg. when opening the calendar view on the 12th at 5:00 with GMT-0200:
      -> the target date is 12th at 1:00
      -> if we set the day mode: target date is 11th at 23:00
      -> if we set the week mode: target date is 11th at 21:00

With this change we keep target_date and highlight_date as local date so
setDate always receives a local date and jquery-ui DatePicker gets the
date in the expected format.

opw-1831368
closes #24188
parent 620a6f45
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment