sayed
Posts: 13
Joined: Tue Oct 13, 2020 8:07 am

How to correctly utilize the timezone option

Fri Mar 05, 2021 9:13 am

Hi,

Long story short:
I want to show the dates in the x-axis based on my customer timzeone which is coming from the server i.e 'Asia/Calcutta' ..etc
I have set useUTC to false and provided the timezone like this:

Code: Select all

time:{
  useUTC: false,
  timezone: 'Asia/Calcutta',
},
gantt-local-timezone-2.PNG
gantt-local-timezone-2.PNG (19.19 KiB) Viewed 1895 times
Yet, I see Highchart is handling the DST transition and I can see 1 hour is missing from the x-axis because of my own time zone which is "Europe/London".

Note; There's no DST in use in 'Asia/Calcutta' timezone


Live Demo: https://jsfiddle.net/Sayed110/o2s0y64f/57/

artakserkses
Posts: 51
Joined: Tue Feb 23, 2021 11:23 am

Re: How to correctly utilize the timezone option

Fri Mar 05, 2021 9:51 am

comment this line:

Code: Select all

	useUTC: false,

sayed
Posts: 13
Joined: Tue Oct 13, 2020 8:07 am

Re: How to correctly utilize the timezone option

Fri Mar 05, 2021 11:11 am

artakserkses wrote:
Fri Mar 05, 2021 9:51 am
comment this line:

Code: Select all

	useUTC: false,
But that will start using the UTC and ignores the provided time zone.

artakserkses
Posts: 51
Joined: Tue Feb 23, 2021 11:23 am

Re: How to correctly utilize the timezone option

Fri Mar 05, 2021 12:04 pm

sayed wrote:
Fri Mar 05, 2021 11:11 am
artakserkses wrote:
Fri Mar 05, 2021 9:51 am
comment this line:

Code: Select all

	useUTC: false,
But that will start using the UTC and ignores the provided time zone.
No, timezone stays (getTime takes time in UTC, and timezone translate it to actual timezone). On your jsfiddle when you comment timezone you have chart between 2200 and 0115, and after adding timezone (without useUTC: false) you have chart between 0330 and 0645 (or something like that :) ) )

sayed
Posts: 13
Joined: Tue Oct 13, 2020 8:07 am

Re: How to correctly utilize the timezone option

Fri Mar 05, 2021 3:01 pm

artakserkses wrote:
Fri Mar 05, 2021 12:04 pm

No, timezone stays (getTime takes time in UTC, and timezone translate it to actual timezone). On your jsfiddle when you comment timezone you have chart between 2200 and 0115, and after adding timezone (without useUTC: false) you have chart between 0330 and 0645 (or something like that :) ) )
Thanks for your help :) . now I just need to get those dates in UTC from the server which's easy.

User avatar
sebastian.h
Posts: 1709
Joined: Fri Aug 07, 2020 7:08 am

Re: How to correctly utilize the timezone option

Fri Mar 05, 2021 4:13 pm

Hi sayed!
That's great to hear that you found a solution.

@artakserkses thanks for your help :)

Best regards.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Gantt”