0

I'm trying to get some currencyFormatter for the application but I encountered some problem.

I am able to use most of the currency formats with corresponding symbols correctly i.e.

var usd = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP' }).format(12345);
var euro = new Intl.NumberFormat('pt-br', { style: 'currency', currency: 'EUR' }).format(12345);
var deEuro = new Intl.NumberFormat('de', { style: 'currency', currency: 'EUR' }).format(12345);

£12,345.00
€12.345,00
12.345,00 €

But when I want to format to Thailand Baht it's not displaying ฿ symbol. Instead, it's THB... Am I doing something wrong or it's not mapped?

var thai = new Intl.NumberFormat('th', { style: 'currency', currency: 'THB' }).format(12345);


THB 12,345.00

I can replace the string after but it's not convenient for me doing this...

var thai = new Intl.NumberFormat('th', { style: 'currency', currency: 'THB' }).format(12345).replace(/\b(\w*THB\w*)\b/, '฿ ');

฿ 12,345.00
Mugetsu
  • 1,739
  • 2
  • 20
  • 41
  • 1
    Possible duplicate of [Intl.NumberFormat() does not show the Bitcoin Ƀ Symbol](https://stackoverflow.com/questions/46019497/intl-numberformat-does-not-show-the-bitcoin-%c9%83-symbol) – 31piy Dec 13 '18 at 08:54

1 Answers1

1

try this

new Intl.NumberFormat('th-TH', { style: 'currency', currency: 'THB' }).format(12345)

Output : "฿12,345.00"

paranaaan
  • 1,626
  • 2
  • 9
  • 17