Search code examples
javascriptcurrencynumber-formatting

Intl.NumberFormat reformatting the currencySymbol


I'm using JS' Intl.Numberformat function, but is there a way I can replace the output that's now: ANG12.45 Format to: fl. 12.45 So replace the default currencyDisplay to a custom naming including a space between the symbol and value?

value = parseFloat(value);
var formatter = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: 'ANG', 
    currencyDisplay: 'symbol',
    minimumFractionDigits: 2
});
return formatter.format(value);

Solution

  • return formatter.format(value).replace("ANG", "ƒ ");