From c3ef733f608752039fef955935813b0290609a11 Mon Sep 17 00:00:00 2001 From: nikhilkuyya Date: Mon, 13 Nov 2023 19:33:08 +0530 Subject: [PATCH 1/2] test From f36832f019ed57515cecb3db3d42cd3b9b034471 Mon Sep 17 00:00:00 2001 From: nikhilkuyya Date: Mon, 13 Nov 2023 19:52:15 +0530 Subject: [PATCH 2/2] feat: dinero logic fix --- src/filters/dineroCurrency.filter.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/filters/dineroCurrency.filter.js b/src/filters/dineroCurrency.filter.js index 68e06f0..237ed4d 100644 --- a/src/filters/dineroCurrency.filter.js +++ b/src/filters/dineroCurrency.filter.js @@ -1,11 +1,12 @@ import Dinero from "dinero.js"; export function formatCurrencyWithDinero(value, factor = 10 ** 2) { - if (Number.isNaN(Number(value))) { + const newValue = Number(value); + if (Number.isNaN(newValue)) { return ""; } - console.trace('formatCurrency', { value }); - const amount = Number.parseFloat(value).toFixed(2) * factor; + console.trace('formatCurrency', { newValue }); + const amount = Number.parseFloat(newValue).toFixed(2) * factor; const dineroObject = Dinero({ amount: amount, currency: "INR" }); const dineroAmount = dineroObject.toRoundedUnit(2); return Intl.NumberFormat("en-IN", { currency: "INR", style: "currency" }).format(dineroAmount);