formatjs / formatjs-old

The monorepo home to all of the FormatJS related libraries.
https://formatjs.io/
156 stars 53 forks source link

fix(intl-utils): prevent infinite recursion loop of getCanonicalRules #591

Closed pyrocat101 closed 4 years ago

pyrocat101 commented 4 years ago

Fixes #543

Intl.getCanonicalLocales is not available on IE11, and therefore we used to rely on Intl.NumberFormat.supportedLocalesOf to polyfill this method.

However, when used together with UnifiedNumberFormat polyfill, this causes an infinite recursion loop because UnifiedNumberFormat.supportedLocalesOf will eventually call into Intl.getCanonicalLocales! This diff puts a stopgap by using Intl.DateTimeFormat instead, since it is not polyfilled by formatjs.