From 76296bc2ee85c284129ad5512e4c9dcdc487010e Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Mon, 3 Apr 2023 23:22:20 -0700 Subject: [PATCH 1/2] Fix realtime. --- lib/date.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/date.js b/lib/date.js index 38e1cc61..d86efcd8 100644 --- a/lib/date.js +++ b/lib/date.js @@ -180,9 +180,9 @@ export function getDateArray(data, startDate, endDate, unit) { const [diff, add, normalize] = dateFuncs[unit]; const n = diff(endDate, startDate) + 1; - function findData(t) { - const d = data.find(({ x }) => { - return normalize(getDateFromString(x)).getTime() === t.getTime(); + function findData(date) { + const d = data.find(({ t }) => { + return normalize(getDateFromString(t)).getTime() === date.getTime(); }); return d?.y || 0; From dee58f8a55c3882f9857af42f86e1348460e2b07 Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Tue, 4 Apr 2023 00:24:03 -0700 Subject: [PATCH 2/2] Fix date function. --- lib/date.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/date.js b/lib/date.js index d86efcd8..13b19e36 100644 --- a/lib/date.js +++ b/lib/date.js @@ -181,8 +181,8 @@ export function getDateArray(data, startDate, endDate, unit) { const n = diff(endDate, startDate) + 1; function findData(date) { - const d = data.find(({ t }) => { - return normalize(getDateFromString(t)).getTime() === date.getTime(); + const d = data.find(({ x, t }) => { + return normalize(getDateFromString(x || t)).getTime() === date.getTime(); }); return d?.y || 0;