When used together with fullcalendar the api endpoint uses the wrong query parameter to set the timezone. api_occurrences expects a query parameter called timezone, but fullcalendar sends it as timeZone (see Latest Docs). Consequently, the backend does not localize timestamps at all and falls back to UTC.
As fullcalendar is a popular addition to django-scheduler, I think the backend should be able to handle both query parameter names.
Possible fix
If timezone wasn't found in the query, try again with timeZone:
if not timezone:
timezone = request.GET.get("timeZone")
When defining the fullcalendar instance in the frontend, the timezone can be added manually to the events endpoint:
// defaults to UTC
var calendar = new FullCalendar.Calendar(mountNode, {
events: "/schedule/api/occurrences?calendar_slug=default",
timeZone: "Europe/Berlin",
// ...
});
// Uses the correct timezone in backend
var calendar = new FullCalendar.Calendar(mountNode, {
events: "/schedule/api/occurrences?calendar_slug=default&timezone=Europe%2FBerlin",
timeZone: "Europe/Berlin",
// ...
});
When used together with fullcalendar the api endpoint uses the wrong query parameter to set the timezone.
api_occurrences
expects a query parameter calledtimezone
, but fullcalendar sends it astimeZone
(see Latest Docs). Consequently, the backend does not localize timestamps at all and falls back to UTC.As fullcalendar is a popular addition to django-scheduler, I think the backend should be able to handle both query parameter names.
Possible fix
If
timezone
wasn't found in the query, try again withtimeZone
:https://github.com/llazzaro/django-scheduler/blob/8aa6f877f17e5b05f17d7c39e93d8e73625b0a65/schedule/views.py#L340C1-L340C1
Possible workaround
When defining the fullcalendar instance in the frontend, the timezone can be added manually to the
events
endpoint:Additional information
v5.10.2
0.9.6