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

Adding missing cents zeros #85

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

douglasresende
Copy link

Test: 1.11        // do nothing
Test: 1.1         // 1.10
Test: 1           // 1.00

if (integerVal !== "0") {
formatted = integerVal + centsSeparator + centsVal;
}
else {
formatted = centsSeparator + centsVal;
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Douglas,

I've faced the same issue as you did, and tried your pull request.
It seems that this curly brace needs to be removed as well, otherwise the script will break.

var str = get();
var new_str = fix_cents_by_str(str);
var price = fix_cents_by_str(price_format(str));
if (new_str != price) set(price);
Copy link

@tr4nquility tr4nquility Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this one, I think it should be if (new_str != price) set(new_str).
After applying the above changes, it works as expected.

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

Successfully merging this pull request may close these issues.

3 participants