shahab ud din gohar
shahab ud din gohar

Reputation: 111

Intl.NumberFormat works differently in safari than in chrome

I am working on a vue project in which global filters are being used. I have defined a global filter to format the number to Japanese currency format. It is working fine in chrome. But in safari it has different output. In chrome i get the correct formatting (e.g 1938500)

¥1,938,500

but in safari of version 15.3 i get

JP¥1,938,500

code snippet for the filter is given below

const formatter = new Intl.NumberFormat("jp-JP", {
    style: "currency",
    currency: "JPY",
    minimumFractionDigits: 0
  });
  return formatter.format(value);

Any help would be grateful

Thank you

Upvotes: 1

Views: 1010

Answers (1)

Aleksey Skakun
Aleksey Skakun

Reputation: 36

Country code for Japan is JP.
Language code for Japanese is ja.

Try this:

const formatter = new Intl.NumberFormat("ja-JP", {
  style: "currency",
  currency: "JPY",
  minimumFractionDigits: 0
});

Upvotes: 1

Related Questions