(This may or may not be related to #95)
First of all, I assume that I've miss-configured something, but my X-axis appears to always be shown as local time instead of UTC. I tried using both timestamp (1536104489000) and datetime (2018-09-04 23:41:29) as x-axis data.
The first entry in the raw data is 1536104489000 (2018-09-04T23:41:29) but when viewed it shows up as 2018-09-05 01:41:29. I am in a UTC+2 timezone.
Is it possible that Apexcharts or underlying frameworks somehow converts my UTC data into local timezone? If so, is it possible to turn it off?
PS: Thank you so much for Apex :) I love it
Hi @tforssander
Yes, I need to look into the datetime offset issues as many users are reporting it.
It is a possibility that while manipulating datetime, I might have accidentally used local time instead of UTC.
Needs digging further, thanks for reporting the issue. And glad you loved it :)
@junedchhipa Great, thank you for the quick reply.
Fixed it. You will see the correct "hours" in the next patch release of ApexCharts
By the way, I checked the code - It is not converting UTC dates to local date anywhere.
ApexCharts deals everything in UTC
Hi,
This solves the issue for GMT+1, but not for those of us on GMT+2 (or any other timezone, really). I've made a suggestion for a solution on https://github.com/apexcharts/apexcharts.js/commit/661647c0f899c2f09e7aa9ee765fba8b06dddb13
Forgot to ping @junedchhipa :) should I try to do a PR?
@bivald Sorry for the delay, missed the message.
I tried your suggestion you provided in that commit, but for some reason - it didn't work great.
Sure, you can try creating a PR :)
Hello
This solves the issue for GMT+1, but not for those of us on GMT+2
There is no solution ?
and please what do you mean by the word PR ?
Hi @junedchhipa , this is still an issue unfortunately, it's not using UTC date times.
See the following example: https://codepen.io/miketrell/pen/mddeyYK
I've modified the start time to 1570606650000, which corresponds to the date '9 October 2019 07:37:30' UTC time, or '9 October 2019 08:37:30' GMT + 1 (my) local time.
If you change you systems local time, the charts line starts from UTC +/- the offset you've set, rather than 07:37:30 UTC as I would expect. Is there a hidden utc toggle you can set on the xaxis that I'm missing here?
(EDIT: I'm running version 3.8.5)
I'm having the same issue. The chart weirdly displays the data on hour 1 instead of hour 0 and then on hour 17 instead of hour 15. 馃
@junedchhipa : where does it say that the display format should be UTC? This change broke my setup, as I want to show timestamps in localtime.
Should I add a boolean option for UTC? Be default, it should be true, but in case someone wants to display local time, it will not convert.
That would be great, yes! Thanks.
@drpuur Can you please create a codepen with the local timestamp series and give me a brief description of what are you expecting v/s what you're seeing?
@junedchhipa : here is the link: https://codepen.io/drpuur/pen/ExaQWGx
It should show a chart with one datapoint every two hours on 06-Jan-2020 (from midnight to midnight localtime, which is from 05-Jan-2020 23:00 (UTC) to 06-Jan-2020 23:00 (UTC).
What I would like to see is the time in localtime, the newest Release of ApexCharts (Version 3.12.0) does show all timestamps in UTC.
Thanks for the codepen. I have added a new boolean option xaxis.labels.datetimeUTC.
Please try it after the next release and let me know if it fixes the issue.
When could we expect the next release? I'm looking forward to it. :-)
In a few hours :)
Just a note: it would be very welcome if the datetimeUTC would work for tooltips as well.
I included the setting for xaxis.labels in my codepen.
@junedchhipa : I noticed today that the xaxis labels are still wrong in Safari (I checked with an IPad and with an IPhone). https://codepen.io/drpuur/pen/ExaQWGx
Tests with Chrome do not have this problem.
Tooltips are fine for Chrome and Safari.
Chrome Output:

Safari Output:

Hi guys,
GMT+2 time still seems not to work. Do you have any estimation about this fix ?

the same issue here, it formats hours in UTC
for incoming people facing this:
as @drpuur showed in his codepen, just add:
xaxis: {
labels: {
datetimeUTC: false
}
}
this will fix it for both labels and tooltip
for incoming people facing this:
as @drpuur showed in his codepen, just add:
xaxis: { labels: { datetimeUTC: false } }this will fix it for both labels and tooltip
You, Sir (and @junedchhipa ofc), are a gentleman and a scholar!
I can't say how long I spent trying rummaging around trying to fix this, thinking I'd messed up a calculation somewhere... ><
Most helpful comment
for incoming people facing this:
as @drpuur showed in his codepen, just add:
this will fix it for both labels and tooltip