Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/view/base/web/js/price-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ define([
am = Number(Math.round(Math.abs(amount - i) + 'e+' + precision) + ('e-' + precision));
r = (j ? i.substr(0, j) + groupSymbol : '') +
i.substr(j).replace(re, '$1' + groupSymbol) +
(precision ? decimalSymbol + am.toFixed(2).replace(/-/, 0).slice(2) : '');
(precision ? decimalSymbol + am.toFixed(precision).replace(/-/, 0).slice(2) : '');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't we slice precision digits as well?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@orlangur
the slice is applied not on the precision but on the price before digits for ex.

0.4880
the slice will remove the price and it will retun the decimals like this :
4880

in this case it should be always 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, thanks for explanation as I didn't try to understand this logic in deep :)


return pattern.replace('%s', r).replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
Expand Down