bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

Investigate timezone conversion of calendars #9206

Open JockeLindberg opened 3 months ago

JockeLindberg commented 3 months ago

Forum post

Hi, we are struggling with the timezone feature. We wanted to set the timezone of the gantt to UTC, so that users from every part of the world would see the same gantt dates. We did as the documentation says, so we set the timezone feature to UTC.

We don't have problems reading data from the backend. For example a task with the startDate set to "2024-01-31T08:00:00Z" will be set correctly by the gantt to start on 31-01-2024 at 08:00am.

We do have problems though sending data to the backend, as the dates are converted to the user local timezone. This is written in your documentation: When saving or syncing data, the dates will be restored to local system time and converted to JSON, in ISO format. So, to fix the issue, we convert back the dates to the UTC timezone. We don't understand why it's like that. We thought that, when the timezone feature is enabled, the gantt component would read and write dates with the specified timezone. But as suggested in other support tickets a workaround exists, converting dates back to UTC, and so we did.

The last problem we have is related to the calendar intervals. Enabling the timezone feature, calendar intervals start to be converted to the user local timezone. And this is an issue as tasks are then rescheduled uncorrectly. We expected that, enabling this feature, the calendar intervals would remain fixed to the specified timezone. But this is not the case. Instead, the calendar intervals remain fixed when the timezone feature is disabled. So we think that the behaviour is reversed here.

To fix this problem, as suggested by many of you in other support tickets, we tried to call the method

later.date.UTC()
``` before instantiating the gantt component.
But unfortunately it didn't work.
To import later we used this piece of code: 

import later from 'node_modules/@bryntum/gantt/source/lib/Engine/vendor/later/later.js';



So we wanted to know if we're doing something wrong and why the timezone is managed so poorly by the gantt component.

These are other tickets we found related to these issues:
viewtopic.php?t=21059&hilit=import+laterjs
viewtopic.php?t=20340&hilit=later+utc
viewtopic.php?p=143149&hilit=timezone+UTC#p143149

Thank you in advance,
Luca.
JockeLindberg commented 2 months ago

Reported for SchedulerPro here: https://forum.bryntum.com/viewtopic.php?p=148143