愚道 7 лет назад
Родитель
Сommit
71056ac097
2 измененных файлов с 4 добавлено и 8 удалено
  1. 2 2
      src/pages/Dashboard/Analysis.js
  2. 2 6
      src/utils/utils.js

+ 2 - 2
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() {

+ 2 - 6
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 = '') {