Skip to content

Commit

Permalink
Fix the number of decimal. It’s 0 or 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzi authored Dec 21, 2023
1 parent 3d859ee commit 4270ae1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/js/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ const bill = (function() {
if (typeof price != 'number' || isNaN(price)) {
return '';
}
return stripFloatingNumber(price) + ' €';
var number = stripFloatingNumber(price);
var string = Number.isInteger(number) ? number : number.toFixed(2);

return string + ' €';
}

function stripFloatingNumber(number) {
Expand Down

0 comments on commit 4270ae1

Please sign in to comment.