Description
At the moment (version 1.25.1), data traces can handle Date objects, which will then be displayed with what seems to be the browser's timezone settings. For example, date = new Date("2017-03-30T00:00:00.000Z")
used on the X-axis in a trace, with a browser in the UTC+1 timezone will be displayed as "Mar 30, 2017, 01:00", which is indeed correct.
However, that same date object cannot be used for x0
/x1
in a shape on the same object.
When using date.toISOString()
instead (both for data and shapes), the timezone indicator (e.g. Z
) at the end of the string is ignored and the string is considered to be within the local time zone.
Here is a jsfiddle to demonstrate the problem: https://jsfiddle.net/tkhmx8Le/
Effectively, the problem is two-fold (and might lead to two separate issues):
- It would be good if
shapes
andannotations
also supported date objects. - ISO-8601 date parsing should take into account the
Z
(or generally+xxxx
or+xx:xx
) timezone indicator before building its internal UTC representation. This is certainly related to Support ISO 8601 timestamps #1003 (and subsequent work).