refactor(frontend): 优化工具函数和 mock handler

- 更新 format.ts 工具函数
- 调整 mock handler 和 useDateRange composable
This commit is contained in:
fawney19
2025-12-12 16:14:49 +08:00
parent 738a8459c9
commit e902595d58
3 changed files with 16 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ export function getDateRangeFromPeriod(period: PeriodValue): DateRangeParams {
*/
export function formatDateTime(dateStr: string): string {
// 后端返回的是 UTC 时间但没有时区标识,需要手动添加 'Z'
const utcDateStr = dateStr.includes('Z') || dateStr.includes('+') ? dateStr : dateStr + 'Z'
const utcDateStr = dateStr.includes('Z') || dateStr.includes('+') ? dateStr : `${dateStr }Z`
const date = new Date(utcDateStr)
// 只显示时分秒