From ae6ce73e7abde1121a788f884e54ccd6cfad0460 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 11 八月 2020 13:59:29 +0800
Subject: [PATCH] 2020-08-11

---
 src/utils/utils.js |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/src/utils/utils.js b/src/utils/utils.js
index ef7a9e2..3fa55b7 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -815,7 +815,10 @@
             if (val > 2958465 || val <= 0) {                 // 鏃堕棿杩囧ぇ鎴栧皬浜庣瓑浜�0
               errors.push(_position + dict['main.excel.content.date.over'])
             } else {                                         // 鏃堕棿鏍煎紡鍖�
-              val = this.formatExcelDate(val)
+              if (val < 60) {                                // 1900-2-29锛宔xcel涓瓨鍦紝瀹為檯涓嶅瓨鍦�
+                val++
+              }
+              val = moment('19000101', 'YYYYMMDD').add(Math.floor(val - 2), 'days').format('YYYY-MM-DD')
             }
           } else if (typeof(val) === 'string') {
             val = val.replace(/(^\s*$)|\t*|\v*/ig, '')
@@ -980,25 +983,6 @@
       bottom: _sqlBottom,
       errors: errors.join('; ')
     }
-  }
-
-  /**
-   * @description 鏍煎紡鍖杄xcel涓殑date鍊�
-   * @param {Number} number 鏃堕棿鍊� 
-   */
-  static formatExcelDate(number) {
-    if (number < 60) { // 1900-2-29锛宔xcel涓瓨鍦紝瀹為檯涓嶅瓨鍦�
-      number++
-    }
-
-    return moment('19000101', 'YYYYMMDD').add(number - 2, 'days').format('YYYY-MM-DD')
-    // const time = new Date((number - 25569) * 24 * 3600000)
-    // time.setYear(time.getFullYear() - 70)
-    // const year = time.getFullYear()
-    // const month = time.getMonth() + 1
-    // const date = time.getDate() - 1
-
-    // return `${year}-${(month < 10 ? '0' + month : month)}-${(date < 10 ? '0' + date : date)}`
   }
 
   /**

--
Gitblit v1.8.0