Explorar o código

fix review issue

愚道 %!s(int64=7) %!d(string=hai) anos
pai
achega
71056ac097
Modificáronse 2 ficheiros con 4 adicións e 8 borrados
  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 { rangePickerValue } = this.state;
     const value = getTimeDistance(type);
     const value = getTimeDistance(type);
     if (!rangePickerValue[0] || !rangePickerValue[1]) {
     if (!rangePickerValue[0] || !rangePickerValue[1]) {
-      return undefined;
+      return '';
     }
     }
     if (
     if (
       rangePickerValue[0].isSame(value[0], 'day') &&
       rangePickerValue[0].isSame(value[0], 'day') &&
@@ -140,7 +140,7 @@ class Analysis extends Component {
     ) {
     ) {
       return styles.currentDate;
       return styles.currentDate;
     }
     }
-    return undefined;
+    return '';
   }
   }
 
 
   render() {
   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 = '') {
 export function getPlainNode(nodeList, parentPath = '') {