c3js / c3js/c3

parseDate doesn't convert time to local properly

Open
#2,173 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

* **C3 version**: 0.4.18
* **D3 version**: 3.5.17
* **Browser**: Chrome 61.0.3163.79
* **OS**: Mac OS

Graph settings:
```
data: {
x: 'x',
xFormat: '%Y-%m-%dT%H:%M:%SZ',
columns: [
['x', ...time_intervals.map(([from]) => from)],
...data.map(row => {
return [row.dimensions[0], ...row.metrics[0]];
})
],
type: 'area'
},
axis: {
x: {
type: 'timeseries',
tick: {
count: 6,
format: x => moment(x).format('M/D, hA')
}
}
},
```

expected result: x axis displays local time
actual: x axis doesn't display local time

known workaround: override parseDate implementation

```
import c3 from 'c3';

c3.chart.internal.fn.parseDate = function(date) {
return new Date(date);
};
```
![screen shot 2017-09-15 at 11 32 47 am](https://user-images.githubusercontent.com/125466/30478604-aba30b3c-9a09-11e7-8cf3-9db16378ad53.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.