mirror of
https://github.com/CorentinTh/it-tools.git
synced 2026-10-21 21:31:21 +00:00
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:
parent
9e4e2c3d24
commit
701ae4af67
1 changed files with 2 additions and 2 deletions
|
|
@ -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}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue