feat(admin): convert all timestamps to Beijing time (UTC+8) for display

Create utils/format.ts with toBeijing() helper. Replace 13 raw .slice().replace() date displays in admin.vue with centralized timezone-aware formatting.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
yuzhiran
2026-06-22 12:51:58 +08:00
parent b6323f02eb
commit d74fc74f28
2 changed files with 31 additions and 13 deletions
+17
View File
@@ -0,0 +1,17 @@
/** 将 ISO 时间字符串转为北京时间(UTC+8)显示 */
export function toBeijing(iso?: string): string {
if (!iso) return '--'
try {
return new Date(iso).toLocaleString('zh-CN', {
timeZone: 'Asia/Shanghai',
hour12: false,
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
})
} catch {
return iso.slice(0, 16).replace('T', ' ')
}
}