Skip to content
Snippets Groups Projects
Commit 3842bbce authored by Allen Gilliland's avatar Allen Gilliland
Browse files

Merge pull request #2391 from metabase/fix-axis-timezone

Ensure axis timestamps are formatted in the correct timezone
parents 543aa0d9 4fe047f3
Branches
Tags
No related merge requests found
......@@ -101,7 +101,11 @@ function applyChartTimeseriesXAxis(chart, settings, series, xValues) {
dimensionColumn = { ...dimensionColumn, unit: dataInterval.interval };
}
chart.xAxis().tickFormat(d => formatValue(d, { column: dimensionColumn }));
chart.xAxis().tickFormat(timestamp => {
// these dates are in the browser's timezone, change to UTC
let timestampUTC = moment(timestamp).format().replace(/[+-]\d+:\d+$/, "Z");
return formatValue(timestampUTC, { column: dimensionColumn })
});
// Compute a sane interval to display based on the data granularity, domain, and chart width
tickInterval = computeTimeseriesTicksInterval(xValues, unit, chart.width(), MIN_PIXELS_PER_TICK.x);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment