formatjs / formatjs

The monorepo home to all of the FormatJS related libraries, most notably react-intl.

Home Page:https://formatjs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DurationFormat Polyfill returns the wrong translations (fr-FR duration returned in Arabic, not French)

aglunndexcom opened this issue · comments

Which package?

intl-durationformat package

Describe the bug

DurationFormat returns the wrong duration strings. In my project, it returns the strings for ar-SA. In the sandbox, it returns the English strings.

To Reproduce

Run:
new Intl.DurationFormat("fr-FR", { style: "short" }).format({ hours: 1, minutes: 1 });

Codesandbox URL

https://codesandbox.io/p/sandbox/javascript-forked-wcf8p7?file=%2Fsrc%2Findex.js%3A9%2C1

Reproducible Steps/Repo

Steps to reproduce the behavior:

  1. In any environment with the DurationFormat polyfill, run:
    new Intl.DurationFormat("fr-FR", { style: "short" }).format({ hours: 1, minutes: 1 });

  2. See:
    '1 س, 1 د'
    or 1 hr, 1 min

Expected behavior

Expect to see: 1 h et 1 mn

That would match the behavior in the Safari browser:
 2023-12-29 at 3 10 32 PM

And the polyfill behavior for other French locales:
new Intl.DurationFormat("fr-CA", { style: "short" }).format({ hours: 1, minutes: 1 });
See: 1 h et 1 mn

Additional context

In addition to the duration strings for fr-FR being incorrect, I'm curious why there isn't consistent default/error behavior. Really appreciate any help fixing this and am more than happy to answer questions if I can... thank you!