Prechádzať zdrojové kódy

始宁农业管理后台:农户管理-农户管理

panyong 1 rok pred
rodič
commit
5b1379ef7f
1 zmenil súbory, kde vykonal 10 pridanie a 1 odobranie
  1. 10 1
      htmldev/shiningWxMini/utils/util.js

+ 10 - 1
htmldev/shiningWxMini/utils/util.js

@@ -379,7 +379,7 @@ function getTs(val, polyfill, type = 'ts') {
   if (!val) {
     return 0
   }
-  if (polyfill === 'YYYY年MM月DD日' || polyfill === 'YYYY-MM-DD') {
+  if (polyfill === 'YYYY年MM月DD日') {
     if (ios) {
       val = val.replace('年', '/').replace('月', '/').replace('日', '')
     } else {
@@ -390,6 +390,15 @@ function getTs(val, polyfill, type = 'ts') {
     }
     return new Date(`${val} 00:00:00`).getTime()
   }
+  if (polyfill === 'YYYY-MM-DD') {
+    if (ios) {
+      val = val.replace(/-/g, '/')
+    }
+    if (type === 's') {
+      return Math.round(new Date(`${val} 00:00:00`).getTime() / 1000)
+    }
+    return new Date(`${val} 00:00:00`).getTime()
+  }
   return 0
 }