diff --git a/app/javascript/controllers/time_series_chart_controller.js b/app/javascript/controllers/time_series_chart_controller.js index 428060ae..0a0c1bee 100644 --- a/app/javascript/controllers/time_series_chart_controller.js +++ b/app/javascript/controllers/time_series_chart_controller.js @@ -51,17 +51,12 @@ export default class extends Controller { _normalizeDataPoints() { this._normalDataPoints = (this.dataValue.values || []).map((d) => ({ ...d, - date: this._parseDate(d.date), + date: new Date(d.date), value: d.value.amount ? +d.value.amount : +d.value, currency: d.value.currency, })); } - _parseDate(dateString) { - const [year, month, day] = dateString.split("-").map(Number); - return new Date(year, month - 1, day); - } - _rememberInitialContainerSize() { this._d3InitialContainerWidth = this._d3Container.node().clientWidth; this._d3InitialContainerHeight = this._d3Container.node().clientHeight; @@ -188,7 +183,7 @@ export default class extends Controller { this._normalDataPoints[this._normalDataPoints.length - 1].date, ]) .tickSize(0) - .tickFormat(d3.timeFormat("%d %b %Y")), + .tickFormat(d3.utcFormat("%d %b %Y")), ) .select(".domain") .remove(); @@ -367,7 +362,7 @@ export default class extends Controller { _tooltipTemplate(datum) { return `