Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convertion isn't correct #20

Closed
GiannhsKer opened this issue Feb 8, 2022 · 8 comments · May be fixed by #69
Closed

Convertion isn't correct #20

GiannhsKer opened this issue Feb 8, 2022 · 8 comments · May be fixed by #69
Labels
enhancement New feature or request

Comments

@GiannhsKer
Copy link

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.

@paul-shuvo
Copy link
Owner

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

@clarkjoshualopez
Copy link

I encounter same issue

@GiannhsKer
Copy link
Author

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.

@paul-shuvo
Copy link
Owner

paul-shuvo commented Feb 9, 2022

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.

paul-shuvo added a commit that referenced this issue Feb 9, 2022
@paul-shuvo
Copy link
Owner

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

@paul-shuvo paul-shuvo added the enhancement New feature or request label Feb 9, 2022
@GiannhsKer
Copy link
Author

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

@paul-shuvo
Copy link
Owner

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

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

@GiannhsKer
Copy link
Author

That solved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants