作者 wjtc8
提交者 Gitee

修复带utc日期格式 yyyy-MM-dd'T'HH:mm:ss.SSS 在safari浏览器中无法正确格式化的问题

1 -/** 1 +/**
2 * 通用js方法封装处理 2 * 通用js方法封装处理
3 * Copyright (c) 2019 ruoyi 3 * Copyright (c) 2019 ruoyi
4 */ 4 */
@@ -18,7 +18,7 @@ export function parseTime(time, pattern) { @@ -18,7 +18,7 @@ export function parseTime(time, pattern) {
18 if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { 18 if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
19 time = parseInt(time) 19 time = parseInt(time)
20 } else if (typeof time === 'string') { 20 } else if (typeof time === 'string') {
21 - time = time.replace(new RegExp(/-/gm), '/'); 21 + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),'');
22 } 22 }
23 if ((typeof time === 'number') && (time.toString().length === 10)) { 23 if ((typeof time === 'number') && (time.toString().length === 10)) {
24 time = time * 1000 24 time = time * 1000