Search code examples
javascriptfirefoxecmascript-intl

Does Firefox 41 have a bug when formatting `new Intl.NumberFormat("es-ES").format(3500)` as `3 500`?


When trying to become familiar with the support of number formatting in the different browsers I found that Firefox 41 formats new Intl.NumberFormat("es-ES").format(3500) as 3 500 (with a space as the group separator) while IE 11, Edge and Google Chrome give me 3.500 (with a dot . as the group separator).

I am wondering, is that a bug in Firefox? Or is the number format allowed in Spanish in Spain ambiguous?

var d1 = 3500;
var esES = new Intl.NumberFormat("es-ES");
var formattedNumber = esES.format(d1);
document.body.insertAdjacentHTML('beforeEnd', '<p>Formatted the number ' + d1 + ' with NumberFormat ' + esES.resolvedOptions().locale + ' as ' + formattedNumber + '<\/p>');


Solution

  • I have tried a Firefox nightly and it returns 3.500 instead of 3 500. Then I searched bugzilla and it looks as there have been various bug reports related to number formatting with locale "es-ES", like https://bugzilla.mozilla.org/show_bug.cgi?id=1013091 and https://bugzilla.mozilla.org/show_bug.cgi?id=1078154 which have been resolved as fixed. So it looks like the issue was regarded as a bug but it has already been fixed in the nightlies/development versions of Firefox.