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 | 21 +++++---------------- 1 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/utils/utils.js b/src/utils/utils.js index 3d0e29e..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, '') @@ -967,7 +970,7 @@ Select @ErrorCode='', @retmsg='', @UserName='${userName}', @FullName='${fullName}' ` } - + return { sql: _sql, lines: result.map((list, index) => { @@ -980,20 +983,6 @@ bottom: _sqlBottom, errors: errors.join('; ') } - } - - /** - * @description 鏍煎紡鍖杄xcel涓殑date鍊� - * @param {Number} number 鏃堕棿鍊� - */ - static formatExcelDate(number) { - const time = new Date((number - 1) * 24 * 3600000 + 1) - 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