Matt Croak
Matt Croak

Reputation: 2888

Issue with formatting for United Arab Emirates Dirham in Numeral.js

I am trying to use Numeral.js to update both the currency symbol and format of a given number. It looks like it's working but when I select United Arab Emirates Dirham the formatting seems strange.

numeral.register("locale", 'ar-ae', {
    delimiters: {
      thousands: " ",
      decimal: ","
    },
    abbreviations: {
      thousand: "k",
      million: "m",
      billion: "b",
      trillion: "t"
   },
   currency: {
     symbol: 'د.إ'
   }
});

numeral.locale('ar-ae');
var monies = numeral(1000000.1).format("$0,0[.]00");
console.log(monies);

> 000,10 000 1د.إ 
// ^ this looks strange

I checked out this website and it looks like the symbol appearing on the right (after the number) is correct but the formatting of the numbers themselves seems closer to the US formatting with commas and decimals.

I have a working code sandbox for the whole project but I only included the code I thought was relevant. All of my other locales/currencies seem to be formatting correctly.

Upvotes: 1

Views: 744

Answers (0)

Related Questions