xiaohaizhao 1 سال پیش
والد
کامیت
c031c6d5de
2فایلهای تغییر یافته به همراه17 افزوده شده و 3 حذف شده
  1. 16 1
      utils/getTime.js
  2. 1 2
      utils/tool.js

+ 16 - 1
utils/getTime.js

@@ -11,6 +11,21 @@ const formatNumber = n => {
     n = n.toString()
     return n[1] ? n : `0${n}`
 }
+
+function getWeek(deta = new Date(), prefix = '周') {
+    weeks = new Array("日", "一", "二", "三", "四", "五", "六");
+    return prefix + weeks[deta.getDay()];
+}
+
+function getYMD(date = new Date()) {
+    const year = date.getFullYear()
+    const month = date.getMonth() + 1
+    const day = date.getDate()
+    return `${year}年${month}月${day}日`
+}
+
 module.exports = {
-    formatTime
+    formatTime,
+    getWeek,
+    getYMD
 }

+ 1 - 2
utils/tool.js

@@ -34,8 +34,7 @@ function mount() {
                 altitude: true,
                 highAccuracyExpireTime: 5000,
                 isHighAccuracy: true,
-                success: res => resolve(res),
-                fail: err => resolve(err)
+                success: res => resolve(res)
             })
         })
     }