From 27b7bcebacddff83a76e791071129d71da9e08fb Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 20 Oct 2021 16:43:27 +0530 Subject: [PATCH] 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 --- ghost/admin/app/helpers/gh-price-amount.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/helpers/gh-price-amount.js b/ghost/admin/app/helpers/gh-price-amount.js index 6bb0beb5db..05f371b62d 100644 --- a/ghost/admin/app/helpers/gh-price-amount.js +++ b/ghost/admin/app/helpers/gh-price-amount.js @@ -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; }