diff options
Diffstat (limited to 'src/components/Numpad.svelte')
| -rw-r--r-- | src/components/Numpad.svelte | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 6a9f3c6e..57e8dd24 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -77,14 +77,16 @@ if (fiat) { const numericFiat = parseFloat((fiatDigits || "0").replace(/\D/g, "")) / 100; - amountFiat = isFinite(numericFiat) ? numericFiat.toFixed(2) : "0.00" as any; + amountFiat = isFinite(numericFiat) + ? numericFiat.toFixed(2) + : ("0.00" as any); amount = numericFiat ? Math.round((numericFiat * sats) / rate) : 0; } else { // integer-only sats, already normalized const a = parseInt((html || "0").replace(/[^\d]/g, "")) || 0; amount = a || 0; const fval = amount ? (amount * rate) / sats : 0; - amountFiat = fval ? fval.toFixed(2) : "0.00" as any; + amountFiat = fval ? fval.toFixed(2) : ("0.00" as any); } }; @@ -211,7 +213,9 @@ element && (element.innerHTML = html); } else { // going -> fiat - const cents = Math.round((parseFloat(String(amountFiat) || "0") || 0) * 100); + const cents = Math.round( + (parseFloat(String(amountFiat) || "0") || 0) * 100, + ); fiatDigits = Math.max(0, cents).toString(); fiat = true; html = formatFiatFromDigits(fiatDigits, decimalChar); @@ -255,7 +259,9 @@ onMount(() => { fiat = $fiatStore; if (fiat) { - const cents = Math.round((parseFloat(String(amountFiat) || "0") || 0) * 100); + const cents = Math.round( + (parseFloat(String(amountFiat) || "0") || 0) * 100, + ); fiatDigits = Math.max(0, cents).toString(); html = formatFiatFromDigits(fiatDigits, decimalChar); // keep html in sync on mount } else { |
