jazzband / django-recurrence

Utility for working with recurring dates in Django.
https://django-recurrence.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
477 stars 188 forks source link

Saving in 'UTC' problem with DST #247

Open bonokl opened 1 year ago

bonokl commented 1 year ago
    I don't know if #191 solves the problem.

Imagine this: server timezone is 'UTC', and user's timezone is 'Europe/Berlin' (+01:00 or +02:00 depending on the time of the year). Let's say user needs daily occurrences between 29.10. and 2.11. at 16:00h. User is creating a recurrence on 26.10. when his timezone is +02:00 compared to UTC. Current implementation will save dtstart as 14:00 UTC. And as result user would get next occurrences: 2022-10-29 14:00 UTC => 2022-10-17 16h Europe/Berlin (+02:00) 2022-10-30 14:00 UTC => 2022-10-17 16h Europe/Berlin (+02:00) 2022-11-01 14:00 UTC => 2022-10-17 15h Europe/Berlin (+01:00) 2022-11-02 14:00 UTC => 2022-10-17 15h Europe/Berlin (+01:00)

Because once the time is converted to UTC we don't know which time user wanted.

https://webis.helpshift.com/hc/en/3-pocket-informant/faq/177-recurring-events-and-daylight-saving-time-1634048685/

it should follow rule of the "creation" time zone, not server/UTC timezone,

Originally posted by @bonokl in https://github.com/jazzband/django-recurrence/issues/174#issuecomment-1325149005

one of the possible ideas can be some kind of setting attribute where user can decide whether to save all data as UTC or as it is

tbrlpld commented 11 months ago

I was just wondering about the same. Is there any start time saved by the widget? I am not really seeing an input for a start time on the widget.

I am assuming now that one would always need a dedicated field for a start time and creation timezone on the model. Then you combine the start time and the original timezone and set as the dtstart of the Recurrence.