javascriptformat

Intl.NumberFormat alter minus symbol


I've read through the Intl.NumberFormat docs and can't find a simple way to achieve something. I want to use a custom character for the minus symbol:

instead of -

(UNICODE − instead of ASCII Code -)

for screen reader reasons.

I don't see an option to do this in the Intl.NumberFormat - is there a way to change the character for currency formatting as part of the options?

Or is simply tagging a replace onto the end the best approach?


Solution

  • To put it very plainly, there is not a way to change the - to an within the Intl.NumberFormat. Just tag on a .replace('-', '−') at the end of the Intl.NumberFormat and you'll be good.