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:
@@ -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', ' ')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user