test(timezone-converter): pin hourCycle h23 in differential fixtures

CI ICU renders midnight as hour 24 under hour12:false for en-CA,
which Date.parse rejects; explicit h23 is deterministic across engines.
This commit is contained in:
a0666660 2026-10-03 22:26:56 +08:00
parent 9e4e2c3d24
commit 701ae4af67

View file

@ -5,7 +5,7 @@ import { convertBetweenTimezones, listTimezones } from './timezone-converter.mod
function getTimeZoneOffsetMs(date: Date, timeZone: string): number {
const parts = new Intl.DateTimeFormat('en-US', {
timeZone,
hour12: false,
hourCycle: 'h23',
year: 'numeric',
month: '2-digit',
day: '2-digit',
@ -79,7 +79,7 @@ it('A to B to A roundtrip is lossless across zone pairs', () => {
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
hour12: false,
hourCycle: 'h23',
}).formatToParts(instant);
const v = Object.fromEntries(parts.map(p => [p.type, p.value]));
const naive = `${v.year}-${v.month}-${v.day} ${v.hour}:${v.minute}:${v.second}`;