Browse Source

优化BASE

九山 3 years ago
parent
commit
9a44f5f103
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/tools/base.js

+ 4 - 3
src/tools/base.js

@@ -16,15 +16,16 @@ export function numberB0(n) {
 export function getBzDate(time, tag, type = "date") {
   let dateTime = new Date(time).getTime() + 3600*1000*24*tag;
   let newDate = new Date(dateTime);
+  let result = newDate.getFullYear() + "-" + numberB0((newDate.getMonth() + 1)) + "-" + numberB0(newDate.getDate());
   switch(type){
     case "date":
-      return newDate.getFullYear() + "-" + numberB0((newDate.getMonth() + 1)) + "-" + numberB0(newDate.getDate());
+      return result;
       break;
     case "datetime":
-      return newDate.getFullYear() + "-" + numberB0((newDate.getMonth() + 1)) + "-" + numberB0(newDate.getDate()) + " " + numberB0(newDate.getHours()) + ":" + numberB0(newDate.getMinutes()) + ":" + numberB0(newDate.getSeconds());
+      return neresult + " " + numberB0(newDate.getHours()) + ":" + numberB0(newDate.getMinutes()) + ":" + numberB0(newDate.getSeconds());
       break;
     default:
-      return newDate.getFullYear() + "-" + numberB0((newDate.getMonth() + 1)) + "-" + numberB0(newDate.getDate());
+      return result;
   }
 }