|
@@ -68,11 +68,13 @@ export function scrollToID(id) { |
|
|
*/ |
|
|
*/ |
|
|
export function timestampToTime(timestamp, format) { |
|
|
export function timestampToTime(timestamp, format) { |
|
|
//时间戳为10位需*1000,时间戳为13位不需乘1000 |
|
|
//时间戳为10位需*1000,时间戳为13位不需乘1000 |
|
|
const length = timestamp.length |
|
|
|
|
|
|
|
|
const length = timestamp.length || '' |
|
|
if (length <= 10) { |
|
|
if (length <= 10) { |
|
|
var date = new Date(timestamp * 1000) |
|
|
var date = new Date(timestamp * 1000) |
|
|
} else { |
|
|
|
|
|
|
|
|
} else if (length > 10) { |
|
|
var date = new Date(timestamp) |
|
|
var date = new Date(timestamp) |
|
|
|
|
|
} else { |
|
|
|
|
|
return '无时间戳' |
|
|
} |
|
|
} |
|
|
let Y = String(date.getFullYear()) |
|
|
let Y = String(date.getFullYear()) |
|
|
let M = String(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) |
|
|
let M = String(date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) |
|
|