Jachym
Jachym

Reputation: 485

Highcharts UTC time

Im a bit lost with one graph Im trying to create using Highcharts. By default Highcharts should use UTC. In the graph below I wanted to create sunrise/sunset graph using UTC times. However, even though in the code I have eg:

[Date.UTC(2000,0,1,07,48),Date.UTC(2000,0,1,16,05)],

The graph still starts at 08:48, which makes no sense to me since the date is created from 07:48

I created a Fiddle where you can see the problem.

Any help is very much appreciated, I need to use UTC because this script must work regardless of system timezone

Upvotes: 1

Views: 994

Answers (1)

Chen Kinnrot
Chen Kinnrot

Reputation: 21015

The problem is with the display, it display the time according to the local timezone of the browser. to solve it, you need to format the date object for utc time.

First fix your tooltip code, call getUTCHour instead of getHour.

The graph looks ok once tooltips show correct hour.

Upvotes: 1

Related Questions