Formattednumber of the Intl-React swap semicolon

Asked

Viewed 27 times

3

Hello folks in my code is as follows

const currencyFormatter = (value: string | number | ReactText[]) => {
    return (
        <FormattedNumber
         value={Number(value)}
         style='currency'
         currency='BRL'
         minimumFractionDigits={2}
         maximumFractionDigits={2}
        />      
    );
  }

However the value returned is:

R$4,567.42

But the right thing would be R$ 4.567,42 .

Someone has already done the correction/formatting in this style?

  • I’ve never particularly used this package, but if you want to simply format the value, you can do it this way: new Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(4567.42)

  • I’ve even used this, it works well, however, I’m following the standard requested by the client that is using this package! :(

  • That one extension helping?

1 answer

-1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.