fix(FEAT-MO-001): 修正概览时间时区显示

This commit is contained in:
2026-08-24 23:08:46 +08:00
parent 1e80e7d2de
commit b1310fb86d
10 changed files with 139 additions and 4 deletions
+18
View File
@@ -0,0 +1,18 @@
import { describe, expect, it } from 'vitest';
import { formatShanghaiDateTime, formatShanghaiTime } from './datetime';
describe('A 股时间显示格式化', () => {
it('将 UTC ISO 时间转换为上海时区的完整日期时间', () => {
expect(formatShanghaiDateTime('2026-08-24T14:16:26.813Z')).toBe('2026-08-24 22:16:26');
});
it('将 UTC ISO 时间转换为上海时区的时分秒', () => {
expect(formatShanghaiTime('2026-08-24T14:16:26.813Z')).toBe('22:16:26');
});
it('收到空值或非法日期时返回占位符', () => {
expect(formatShanghaiDateTime(undefined)).toBe('—');
expect(formatShanghaiTime('not-a-date')).toBe('—');
});
});