Skip to content

Test that -u-ca-iso8601 implies hc-h23 #4882

@hsivonen

Description

@hsivonen

There should be a test that -u-ca-iso8601 implies hc-h23 as it currently does in Firefox and Safari but not in Chrome.

Consider:

console.log(new Intl.DateTimeFormat("en-US-u-ca-iso8601", {dateStyle: "short", timeStyle: "short", timeZone: "America/Los_Angeles"}).format(new Date(Date.UTC(2026, 0, 21, 6, 31, 12))));

In Chrome, this results in "2026-01-20, 10:31 PM" (unwanted). In Firefox and Safari, this results in "2026-01-20, 22:31" (wanted).

In contrast, FI is an h23 region, so

console.log(new Intl.DateTimeFormat("fi-FI-u-ca-iso8601", {dateStyle: "short", timeStyle: "short", timeZone: "America/Los_Angeles"}).format(new Date(Date.UTC(2026, 0, 21, 6, 31, 12))));

results in "2026-01-20 klo 22:31" in all three browsers.

Note the colon as the time component separator. Contrast with

console.log(new Intl.DateTimeFormat("fi-FI", {dateStyle: "short", timeStyle: "short", timeZone: "America/Los_Angeles"}).format(new Date(Date.UTC(2026, 0, 21, 6, 31, 12))));

saying "20.1.2026 klo 22.31".

An explicit hour cycle override takes effect in all three:

`console.log(new Intl.DateTimeFormat("en-US-u-ca-iso8601-hc-h23", {dateStyle: "short", timeStyle: "short", timeZone: "America/Los_Angeles"}).format(new Date(Date.UTC(2026, 0, 21, 6, 31, 12))));``

says "2026-01-20, 22:31" in all three and

console.log(new Intl.DateTimeFormat("fi-FI-u-ca-iso8601-hc-h12", {dateStyle: "short", timeStyle: "short", timeZone: "America/Los_Angeles"}).format(new Date(Date.UTC(2026, 0, 21, 6, 31, 12))));

says "2026-01-20 klo 10:31 ip." in all three.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions