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

formatNumber does not support custom decimal? #129

Open
tofdragon opened this issue Dec 8, 2015 · 5 comments · May be fixed by #183
Open

formatNumber does not support custom decimal? #129

tofdragon opened this issue Dec 8, 2015 · 5 comments · May be fixed by #183

Comments

@tofdragon
Copy link

source:
var formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) {
.......................
number = unformat(number);
.......................
}

Why don't unformat passing parameters to a decimal? unformat(number, decimal) ?
decimal Is not equal to . 。There will be a problem

@Lakshmi-Sharma
Copy link

@tofdragon If you want to use a different decimal value, use settings:

accounting.settings = { number: { decimal: "*"}}

and then, when you do

accounting.unformat(123*456) = 123.456

Use the accouting.js file instead of the accounting.min.js
There seems to be some issue with the accounting.min.js, it does not handle this correctly

@tofdragon
Copy link
Author

@Lakshmi-Sharma Thank you for your advice

I have to modify the source code to

var formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) {
....................... //add decimal parameter
number = unformat(number, decimal);
.......................
}

The basic test is normal。But don't know how the author's intention, don't know is a bug, or the authors have other meanings

@Lakshmi-Sharma
Copy link

@tofdragon If you change it in the settings, you shouldn't have to add it as a parameter.

@tofdragon
Copy link
Author

@Lakshmi-Sharma This is a global, in a page will have multiple influence each other

@pycarlson
Copy link

#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

Successfully merging a pull request may close this issue.

3 participants