Open ArneBo opened 4 years ago
Timezone on server is UTC, which is 2h behind CET. timezone is reading from system I think. But the timezone is also defined in settings. So we could call the settings here, no?
Can you provide an example for the bug? I still think everything is correct.
The Timezone on the server is not important as long as everything is correct there, i.e. the clock is set to the correct time. Best done via NTP.
In Django time is saved in the DB in UTC (if settings.USE_TZ
).
When viewing and entering times settings.TIME_ZONE
ist used to interpret and show values. The time is converted to UTC for the DB on that basis.
But I changed this to use event.tzname
(The timezone of the event) using timezone.override
and {% timezone event.tzname %}
So, if you enter 10 am and US/Pacific (during daylight saving time) the time is converted to 5 pm UTC and saved in the DB as 5 pm. When the event is retrieved and shown in a model the time is again converted back to US/Pacific and shown as 10 am.
filter(start__gte=timezone.now())
uses the time in the db and compares it to the server time (converting it to UTC too).
So the event starting at 10 am will be shown till 5 pm UTC and 7 pm CEST. Maybe this looks like a bug to you, but really the event will be shown till 10 am PDT. The timezone is shown in parenthesis after the time: "CIRCLE UM 10:00 (PDT)"
The display of times is correct in the frontend. The Tag in the emails however seems to show UTC. Also the filter to show only future events is starting from UTC. So events that happened less than two hours ago will still be listet on /circles/ but can not be joined as they are already in the past. They will not be listed on the startpage.
Sorry, I cannot confirm both issues. Again: Please provide me with an example.
Can you provide an example?
I doubt it, because the code is so simple: https://github.com/CoronaCircles/coronacircles/blob/c65a89ca4555cb3e1c4dfb4f7589efd5e2efdf67/circles/models.py#L31-L33
Possible explanation: When an event is not in CEST, it be would be shown with a time seemingly in the past. But not if you take the timezone into consideration (which is always shown next to the time).