1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-23 15:19:38 +02:00

Match Plaid holding values on current day (#2212)

* Match Plaid holding values on current day

* Fix chart timezone issue

* Add timezone tests for syncs

* Hide sidebars on trades test
This commit is contained in:
Zach Gollwitzer 2025-05-06 09:25:49 -04:00 committed by GitHub
parent 470b753833
commit 2000f05453
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 242 additions and 21 deletions

View file

@ -1,6 +1,8 @@
import { Controller } from "@hotwired/stimulus";
import * as d3 from "d3";
const parseLocalDate = d3.timeParse("%Y-%m-%d");
export default class extends Controller {
static values = {
data: Object,
@ -51,10 +53,12 @@ export default class extends Controller {
_normalizeDataPoints() {
this._normalDataPoints = (this.dataValue.values || []).map((d) => ({
date: new Date(`${d.date}T00:00:00Z`),
date: parseLocalDate(d.date),
date_formatted: d.date_formatted,
trend: d.trend,
}));
console.log(this._normalDataPoints);
}
_rememberInitialContainerSize() {
@ -185,7 +189,7 @@ export default class extends Controller {
this._normalDataPoints[this._normalDataPoints.length - 1].date,
])
.tickSize(0)
.tickFormat(d3.utcFormat("%b %d, %Y")),
.tickFormat(d3.timeFormat("%b %d, %Y")),
)
.select(".domain")
.remove();