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

Unformat not respecting settings #175

Open
enclle opened this issue May 18, 2017 · 4 comments
Open

Unformat not respecting settings #175

enclle opened this issue May 18, 2017 · 4 comments

Comments

@enclle
Copy link

enclle commented May 18, 2017

I'm brazilian, here in Brazil we use "," as decimal separator, "." as thousand separator and "R$" as currency symbol.
I have some text input with formatted input, like "R$ 123,45", then I call unformat(text) to set the (double) value and the result as expected would be (doube) 123.45, but the actual result is (double) 12345.

The accounting.settings is:

accounting.settings = {
currency: {
symbol : "R$",
format: "%s%v",
decimal : ",",
thousand: ".",
precision : 2
},
number: {
precision : 0,
thousand: ".",
decimal : ","
}
}

@enclle
Copy link
Author

enclle commented May 18, 2017

As a temporary fix I do: unformat(text.replace(",","."))

@fauresco
Copy link

I'm also from Brazil and had the same issue.

I was about to try to fix the issue myself, debugging the unminified version of the library but, it turns out that the unminified version works just fine!

The dev must check the provided minified version for download, it seems to be outdated.

While this doesn't happen, we can just grab the unminified version, add to our projects and run some minification process ourselves.

@ram-nadella
Copy link

We just ran into this issue and the solution @fauresco is proposing is the way to go for the time being. The unformat logic in the non-minified version of the file works as expected.

Looks like the minified and non-minified files have diverged quite a bit, I see updated 2 years ago vs 6 months ago in the commit history.

@juanca
Copy link

juanca commented Oct 12, 2017

We ran into the same issue and are proposing this solution: #183

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

No branches or pull requests

4 participants