Explorar el Código

【公共函数修改】【优化】【判定时间戳为字符还是数字处理】

livetest
[caserKing] hace 4 años
padre
commit
6274587e52
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. +6
    -0
      utils/util.js

+ 6
- 0
utils/util.js Ver fichero

@@ -35,6 +35,9 @@ const formatTime = (date, fmt) => {
if (!date) {
return date;
}
if (typeof date === 'string' && date.length === 13) {
date = Number(date);
}
if (typeof date == "number") {
date = new Date(date);
}
@@ -92,6 +95,9 @@ function qrc(id, code, width, height) {
});
}
function fmtDate(obj) {
if (typeof obj === 'string' && obj.length === 13) {
obj = Number(obj);
}
var date = new Date(obj);
var y = 1900 + date.getYear();
var m = "0" + (date.getMonth() + 1);


Cargando…
Cancelar
Guardar