mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Updated price amount helper to return decimal values
no refs - price amount helper was previously always returning whole numbers after rounding-off amount values - this change updates the behavior to show decimal values upto 2 places when the amount is not a whole number, and a whole number otherwise
This commit is contained in:
parent
82470a723c
commit
27b7bcebac
1 changed files with 6 additions and 1 deletions
|
@ -2,7 +2,12 @@ import {helper} from '@ember/component/helper';
|
|||
|
||||
export function ghPriceAmount(amount) {
|
||||
if (amount) {
|
||||
return Math.round(amount / 100);
|
||||
let price = amount / 100;
|
||||
if (price % 1 === 0) {
|
||||
return price;
|
||||
} else {
|
||||
return Math.round(price * 100) / 100;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue