Commit fc5d0229 authored by 姬鋆屾's avatar 姬鋆屾

推修改时间报错

parent a09bf408
export const timestampToTime = (timestamp, transLength) => {
// 时间戳为10位需*1000,时间戳为13位不需乘1000
let date = null;
if (timestamp) {
if (timestamp.length < 13) {
date = new Date(timestamp * 1000);
} else {
......@@ -19,13 +20,17 @@ export const timestampToTime = (timestamp, transLength) => {
let m =
(date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
":";
let s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
let s =
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
switch (transLength) {
case 3:
return Y + M + D;
case 6:
return Y + M + D + h + m + s;
}
} else {
return "";
}
};
// 小时:分钟 ==》 转分钟
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment