diff --git a/src/pages/Dashboard/Analysis.js b/src/pages/Dashboard/Analysis.js index 4ba2f017750d5fa09f059a8c954005693b0822f2..f0485d4e04d733ba0a3fc9d453c5feb4b56f20d8 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 a506dd03413175bcd1d10cade1b7508b9997be8a..c5e5fb8687ed3ea3992eec1c647bf8f4fe46716d 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 = '') {