amcharts / amcharts5

The newest, fastest, and most advanced amCharts charting library for JavaScript and TypeScript apps.
Other
357 stars 95 forks source link

Unified timezoneOffset in DateFormatter #676

Closed OwsOwies closed 2 years ago

OwsOwies commented 2 years ago

Question

Hi. I was wondering if there is an option to somehow set unified timezoneOffset in DateFormatter.
I have got monthly line chart, with 12 points, each point contains aggregated data for a month under a single timestamp. Those timestamps are the first days of the months (1st January, 1st February etc.). The problem I encountered is with european summer time, american daylight saving time and such. For example when I try to display those points my chart shows two points for October (which technically is correct) because

new Date(1633039200000) Fri Oct 01 2021 00:00:00 GMT+0200 (Central European Summer Time)

new Date(1635717600000) Sun Oct 31 2021 23:00:00 GMT+0100 (Central European Standard Time)

I generate those timestamps based on current timezoneOffset of the client. I would like the second one to be GMT+2 too (offset as of today), which would then be correctly displayed as 1st November. Is there an option to make the chart show this unified to current timezoneOffset? I saw there was an option to do this in amcharts4 https://www.amcharts.com/docs/v4/reference/dateformatter/#timezoneOffset_property but I haven't found it in amcharts5.

martynasma commented 2 years ago

amCharts 5 has only global timezone setting. More information here: https://www.amcharts.com/docs/v5/getting-started/root-element/#time-zone

OwsOwies commented 2 years ago

I've seen this one, but as I understand it changes nothing to solve my problem. I don't want to set a timezone, I want to tweak inconsistencies inside a single timezone caused by changes in it occurring during the year.

Basically, if a timezone is +0200 for half a year and +0100 for the other half, I don't want the chart to acknowledge that, I want to render everything as whole year was +0200 if it is the current offset.

So there is nothing in library itself to achieve the result I described but it was in previous version, correct?

martynasma commented 2 years ago

Basically, if a timezone is +0200 for half a year and +0100 for the other half, I don't want the chart to acknowledge that, I want to render everything as whole year was +0200 if it is the current offset.

That does not seem right, from dataviz standpoint.

So there is nothing in library itself to achieve the result I described but it was in previous version, correct?

Once thing comes to mind: UTC does not have DSTs. Timestamps are in UTC. So why you don't use "UTC" as timezone to completely eliminate any DST switching?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.