I am using FormattedNumber from React Intl in a large React project that has the ability for different languages.
Here is the currency component I made so that I can easily insert a formatted currency into my views:
import {FormattedNumber} from 'react-intl'; const Currency = (props) => { const currency = props.currency; const minimum = props.minimumFractionDigits || 2; const maximum = props.maximumFractionDigits || 2; return <FormattedNumber value={props.amount} style="currency" currency={currency} minimumFractionDigits={minimum} maximumFractionDigits={maximum} />; }; export default Currency;
The component works great. And it works as expected. In English - when currency is GBP - the amount is formatted as such:
ยฃ4.00
In German - when currency is EUR - it is formatted as such:
4,00โฌ
However, I need to format the amount differently in a particular case. So, what I'm looking for is Euro, expecting up to the amount, for example:
โฌ4,00
Is this possible with FormattedNumber? I do not want to manually reformat the formatted number if I can avoid it.
source share