Skip to content

Commit

Permalink
Update test/intl402/DateTimeFormat/prototype/formatToParts/offset-tim…
Browse files Browse the repository at this point in the history
…ezone-correct.js

Co-authored-by: Richard Gibson <[email protected]>
  • Loading branch information
2 people authored and ptomato committed Sep 26, 2023
1 parent 43d5e70 commit b8101b4
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ let tests = {
'−10:03': {hour: "5", minute: "21"},
'−0509': {hour: "10", minute: "15"},
};
Object.keys(tests).forEach((timeZone) => {
Object.entries(tests).forEach(([timeZone, expected]) => {
let df = new Intl.DateTimeFormat("en",
{timeZone, timeStyle: "short"});
let res = df.formatToParts(date);
let hour = res.filter((t) => t.type=="hour")[0].value
let minute = res.filter((t) => t.type=="minute")[0].value
let expected = tests[timeZone];
assert.sameValue(hour, expected.hour, "hour in TimeZone:" + timeZone);
assert.sameValue(minute, expected.minute, "minute in TimeZone:" + timeZone);
let hour = res.filter((t) => t.type === "hour")[0].value
let minute = res.filter((t) => t.type === "minute")[0].value
assert.sameValue(hour, expected.hour, `hour in ${timeZone} time zone:`);
assert.sameValue(minute, expected.minute, `minute in ${timeZone} time zone:`);
});

0 comments on commit b8101b4

Please sign in to comment.