From 1d13da848ca8911ff262f116a6797adeae367889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=E7=94=B0=E5=A4=A7=E6=A8=B9?= Date: Wed, 13 May 2020 20:54:19 +0900 Subject: [PATCH 1/2] =?UTF-8?q?4/0=E3=81=AB=E3=81=AA=E3=82=8B=E3=81=AE?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/formatGraphForPatients.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/formatGraphForPatients.ts b/utils/formatGraphForPatients.ts index 75962de67b037..90c7b9eab008c 100644 --- a/utils/formatGraphForPatients.ts +++ b/utils/formatGraphForPatients.ts @@ -17,16 +17,22 @@ export type GraphDataType = { export default (data: DataType[]) => { const graphData: GraphDataType[] = [] const today = new Date() + const yesterday = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + ) + console.log(yesterday) let patSum = 0 data - .filter(d => new Date(d['日付']) < today) + .filter(d => new Date(d['日付']) < yesterday) .forEach(d => { const date = new Date(d['日付']) const subTotal = d['小計'] if (!isNaN(subTotal)) { patSum += subTotal graphData.push({ - label: `${date.getMonth() + 1}/${date.getDate() - 1}`, + label: `${date.getMonth() + 1}/${date.getDate()}`, transition: subTotal, cumulative: patSum }) From a9915a56636fe978d1e41682819e2fadb0f569b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=A0=E7=94=B0=E5=A4=A7=E6=A8=B9?= Date: Wed, 13 May 2020 20:55:12 +0900 Subject: [PATCH 2/2] fix --- utils/formatGraphForPatients.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/formatGraphForPatients.ts b/utils/formatGraphForPatients.ts index 90c7b9eab008c..ee052a534fe04 100644 --- a/utils/formatGraphForPatients.ts +++ b/utils/formatGraphForPatients.ts @@ -17,12 +17,12 @@ export type GraphDataType = { export default (data: DataType[]) => { const graphData: GraphDataType[] = [] const today = new Date() + // temporary fix const yesterday = new Date( today.getFullYear(), today.getMonth(), today.getDate() ) - console.log(yesterday) let patSum = 0 data .filter(d => new Date(d['日付']) < yesterday)