Incubator-echarts: xaxis type=time labels do not reflect series data

Created on 27 Sep 2019  ·  10Comments  ·  Source: apache/incubator-echarts

Version

4.3.0

Reproduction link

https://codesandbox.io/s/echarts-xaxis-time-ef3e3

Steps to reproduce

  1. create xaxis type=time
  2. populate series with date range from 2019-10-01 to 2019-10-31

What is expected?

I expect labels to be dates from "2019-10-01 00:00" to "2019-10-31 00:00".

What is actually happening?

Last label is "2019-10-30 23:00" instead of "2019-10-31 00:00".


en not-a-bug timezone

Most helpful comment

@gajus
By default, echarts uses local timezone to formate time labels.
But if we set timezone to Eastern European, there would be
Eastern European Summer Time issue, as @devyumao said.

The boundary of Eastern European Summer Time and Eastern European Standard Time is:

new Date(1572137999999)
Sun Oct 27 2019 03:59:59 GMT+0300 (Eastern European Summer Time)
new Date(1572137999999 + 1)
Sun Oct 27 2019 03:00:00 GMT+0200 (Eastern European Standard Time)

In your case, the time axis is from Oct 1 to Oct 31, which crosses the boundary (about Oct 27),
so the time labels look weird.

So, the option useUTC is recommended in your case:

option = {
    useUTC: true,
    xAxis: {...},
    yAxis: {...}
    series: {
        ...
    }
}

If you are using string-formatted time in data (for example, "2019-10-01"),
we do not need to convert the time to UTC, it's OK to keep the current time data.
The useUTC just make sure all of the string time formatted in consistent way.

All 10 comments

Screen Shot 2019-09-27 at 18 34 19
Last label is "2019-10-31 00:00"

Not when I view it.

Screenshot 2019-09-27 at 15 36 56

Using Chrome latest version on macos.

This may be a bug related to time-zone. @gajus Could you tell us what your time-zone is?

Eastern European Summer Time

This shouldn't say waiting-for: author anymore.

Thanks for your update. Let's see if we can get this fixed in 4.6.0.
BTW, if you're interested in making a pull request, that would be perfect because it may be easier for you to reproduce this problem. Please let us know if you need some help on this.

Eastern European Summer Time is a daylight saving time zone with which different browsers handle in different ways, e.g., the timestamp 1572469200000 in Firefox is equivalent to '2019-10-31 00:00', but in Chrome it is '2019-10-30 23:00'.
I'm not sure whether this is a bug. Hereby to let you know. @100pah

@devyumao Chrome and Firefox are the same in my computer for new Date(1572469200000),
they are both Wed Oct 30 2019 23:00:00 GMT+0200 (Eastern European Standard Time)

@gajus
By default, echarts uses local timezone to formate time labels.
But if we set timezone to Eastern European, there would be
Eastern European Summer Time issue, as @devyumao said.

The boundary of Eastern European Summer Time and Eastern European Standard Time is:

new Date(1572137999999)
Sun Oct 27 2019 03:59:59 GMT+0300 (Eastern European Summer Time)
new Date(1572137999999 + 1)
Sun Oct 27 2019 03:00:00 GMT+0200 (Eastern European Standard Time)

In your case, the time axis is from Oct 1 to Oct 31, which crosses the boundary (about Oct 27),
so the time labels look weird.

So, the option useUTC is recommended in your case:

option = {
    useUTC: true,
    xAxis: {...},
    yAxis: {...}
    series: {
        ...
    }
}

If you are using string-formatted time in data (for example, "2019-10-01"),
we do not need to convert the time to UTC, it's OK to keep the current time data.
The useUTC just make sure all of the string time formatted in consistent way.

Closed due to not-a-bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akvaliya picture akvaliya  ·  3Comments

RoxetteI picture RoxetteI  ·  3Comments

antorman picture antorman  ·  3Comments

jarben picture jarben  ·  3Comments

arssam picture arssam  ·  3Comments