tc39/ecma402

Intl.DateTimeFormat era: "long" outputs date in addition to era

Closed this issue · 3 comments

In Chrome and Firefox, this code gives:
"20/12/2020 Anno Domini"
rather than
"Anno Domini"

const date = new Date(Date.UTC(2020, 11, 20, 3, 23, 16, 738));

console.log(
  new Intl.DateTimeFormat('en-GB', {
    timeZone: 'Australia/Sydney',
    era: "long",
  }).format(date),
);
sffc commented

This is probably spec-conformant since the spec allows the implementation to load basically whatever pattern it wants, but this behavior seems surprising. Requesting only one field should produce a pattern with that one field in standalone mode. Same thing appears to happen for timeZoneName. However, standalone month and weekday have the expected behavior.

@zbraniecki

anba commented

Dup of #461.

sffc commented

Dup of #461.

Indeed! Thank you.