From 71056ac0976ccd3b7847f8fe717a3d1db3504600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=84=9A=E9=81=93?= Date: Wed, 29 Aug 2018 17:21:37 +0800 Subject: [PATCH] fix review issue --- src/pages/Dashboard/Analysis.js | 4 ++-- src/utils/utils.js | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 4ba2f017..f0485d4e 100644 --- a/src/pages/Dashboard/Analysis.js +++ b/src/pages/Dashboard/Analysis.js @@ -132,7 +132,7 @@ class Analysis extends Component { const { rangePickerValue } = this.state; const value = getTimeDistance(type); if (!rangePickerValue[0] || !rangePickerValue[1]) { - return undefined; + return ''; } if ( rangePickerValue[0].isSame(value[0], 'day') && @@ -140,7 +140,7 @@ class Analysis extends Component { ) { return styles.currentDate; } - return undefined; + return ''; } render() { diff --git a/src/utils/utils.js b/src/utils/utils.js index a506dd03..c5e5fb86 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -47,12 +47,8 @@ export function getTimeDistance(type) { ]; } - if (type === 'year') { - const year = now.getFullYear(); - - return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)]; - } - return undefined; + const year = now.getFullYear(); + return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)]; } export function getPlainNode(nodeList, parentPath = '') { -- GitLab