2

I want to change currency format in Numeral.js with another country. How to do that?

fufu
  • 99
  • 3
  • 13

3 Answers3

16

Did you manage to solve that problem?

I needed to use with pt-br and I did it:

import Numeral from "numeral";
import "numeral/locales/pt-br";

// switch between locales
Numeral.locale('pt-br');

//Usage
Numeral(100).format("$0.00")
// output R$100,00
  • It works partially. You need to set a mask, like this: Numeral(100).format("$#,##0.00"); – Max Hiroyuki Ueda Sep 15 '17 at 17:54
  • I didn't solve my problem yet, people who serve the data change it to fixed value (returning with full format) a week after I asked here, so I'm not using Numeral.js anymore. Is this answer works well? Considering to accept this.. – fufu Sep 17 '17 at 10:55
  • is there any solution for Indian currency! I have wasted 3 hours on it ? – Aahad Jun 28 '23 at 11:49
2

You can do the following;

//import

import Numeral from "numeral";

//use

numeral("10").value()
Mahib
  • 3,977
  • 5
  • 53
  • 62
C. Draghici
  • 157
  • 5
0

Numeral.js v. 2.0.6

import numeral from 'numeraljs';

<Typography>$ {numeral(3000).format('0,0')} pesos</Typography>
panchicore
  • 11,451
  • 12
  • 74
  • 100