mirror of
https://github.com/we-promise/sure.git
synced 2026-04-10 15:54:48 +00:00
Display chart dates in UTC
This commit is contained in:
@@ -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 `
|
||||
<div style="margin-bottom: 4px; color: ${tailwindColors.gray[500]};">
|
||||
${d3.timeFormat("%b %d, %Y")(datum.date)}
|
||||
${d3.utcFormat("%b %d, %Y")(datum.date)}
|
||||
</div>
|
||||
|
||||
<div style="display: flex; align-items: center; gap: 16px;">
|
||||
|
||||
Reference in New Issue
Block a user