paul-shuvo/nodejs-currency-converter

Convertion isn't correct

Closed this issue · 8 comments

I tried converting 1 JPY to EUR and it returns 76 which is incorrect. The correct number is 0,0076, but I also tried converting 1 CHF to EUR which is 0.95 but its output is 95. The code I used is copy paste from the documentation.

Are you using the latest version? I ran the conversion here and it looks fine. Could you share your code anyway?

I encounter same issue

I ran yarn list --pattern currency-converter-lt to see the version of the package and it is the same written in the runkit (1.2.3). I copy pasted your code to my machine and it returned 95.

I think I figured out the problem; it's the decimal comma(,). Depending on your locale, google result returns either 1,000.00 or 1.000,00 i.e switches the comma and the dot. I'll take a look as soon as I can.

@GiannhsKer @clarkjoshualopez let me know if you still have trouble with the conversion.

No I still have the same issue, I'm connecting from Greece if that helps.

Pass the isDecimalComma:true in the constructor as the following:

let currencyConverter = new CC({from:"USD", to:"JPY", amount:100, isDecimalComma:true})

That solved it!