Is it possible to display tasks/timescale in UTC?


#1

I note from other forum posts that there is an option to specify that dates loaded into gantt are in UTC

gantt.config.server_utc = true;

As the docs state

“enables converting server-side dates from UTC to a local time zone (and backward) while sending data to the server”

However is there any option to support positioning and scale the dates in UTC rather than the local (machine) timezone?


#2

Hello David,
When you load the task data, all dates are already bound to the actual dates regardless of the timezone settings. For example, 2020-04-01 00:00:00 would be loaded as 2020-04-01 00:00:00 even if you change the timezone.

Here is the comparison of how it works with and without the option:

Modifying the displayed dates and positioning would mean that it should work the same way as it works without that option. Could you clarify why do you need that?


#3

@ramil hi

My question comes because our use of Gantt is more focussed on Hour and Minute where the time zone the user is working in is potentially different from their machine time zone (they may be working with a team in a different country). So things like Daylight Savings changes become important.

I am aware that Gantt uses Javascript Date throughout and this isn’t time zone aware. I was looking to see if there was an alternative way to display the plan e.g. UTC which would rule out any 1 hour shift.


#4

Hello David,
Thank you for the clarification.
If you work with hours, I think, it would be better to add the hour scale and the hour duration unit:
http://snippet.dhtmlx.com/5/3e1ae13ac

That snippet will be loaded with the same dates regardless of the timezone settings.

I understand that users might add a task and adjust it to their time zone, while other users will think it is also their timezone.

With the server_utc option, the task dates will depend on the timezone:
http://snippet.dhtmlx.com/5/e4d8174b1

If you highlight non-working hours, users might get the idea that although the task starts at 02:00, it actually starts at 08:00 at their time.

Another possible way would be to hide non-working hours:
https://docs.dhtmlx.com/gantt/api__gantt_skip_off_time_config.html
http://snippet.dhtmlx.com/5/d1f68bf46