From 2ceaccf9ab3b9eb5f28704ad29115ca774c2c783 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 11 Nov 2018 12:43:35 +0900 Subject: [PATCH] Fix chart engine --- src/chart/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/chart/index.ts b/src/chart/index.ts index c12e659023..84fbbac656 100644 --- a/src/chart/index.ts +++ b/src/chart/index.ts @@ -241,8 +241,8 @@ export default abstract class Chart { const [y, m, d, h] = this.getCurrentDate(); const gt = - span == 'day' ? utc([y, m, d - range]) : - span == 'hour' ? utc([y, m, d, h - range]) : + span == 'day' ? utc([y, m, d]).subtract(range, 'days') : + span == 'hour' ? utc([y, m, d, h]).subtract(range, 'hours') : null; // ログ取得 @@ -285,8 +285,8 @@ export default abstract class Chart { // 整形 for (let i = (range - 1); i >= 0; i--) { const current = - span == 'day' ? utc([y, m, d - i]) : - span == 'hour' ? utc([y, m, d, h - i]) : + span == 'day' ? utc([y, m, d]).subtract(i, 'days') : + span == 'hour' ? utc([y, m, d, h]).subtract(i, 'hours') : null; const log = logs.find(l => utc(l.date).isSame(current));