feat:流量展示
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m30s

This commit is contained in:
sexygoat
2026-04-27 15:57:31 +08:00
parent a055ff166a
commit d52efaadcb
3 changed files with 299 additions and 97 deletions

View File

@@ -155,7 +155,7 @@ export function formatDateRange(startDate: string, endDate: string): string {
/**
* 格式化日期时间
* @param date 日期字符串或时间戳
* @param date 日期字符串或时间戳支持Unix时间戳秒自动检测
* @param format 格式化模板,默认 'YYYY-MM-DD HH:mm:ss'
* @returns 格式化后的日期字符串
*/
@@ -165,7 +165,14 @@ export function formatDateTime(
): string {
if (!date) return '-'
const d = new Date(date)
let d: Date
const numDate = typeof date === 'string' ? Number(date) : date
if (typeof numDate === 'number' && numDate > 1000000000 && numDate < 2000000000) {
d = new Date(numDate * 1000)
} else {
d = new Date(date)
}
if (isNaN(d.getTime())) return '-'
const year = d.getFullYear()