From a7b17ffd165e28be2bb707ad7679c993fd17a4d6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 15 Jun 2026 09:59:34 -0700 Subject: Normalize amount input out of scientific notation Chrome's number input emits "1e-8"-style values when stepping the tiny BTC step; convert any scientific-notation value back to a plain decimal string on input. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/app.js b/src/app.js index 208af57..259c06f 100644 --- a/src/app.js +++ b/src/app.js @@ -632,7 +632,19 @@ function sendForm() { value: s.max ? (s.unit === 'sats' ? String(estimatedMaxSats()) : fmtBtc(estimatedMaxSats())) : s.amount, - onInput: (e) => (s.amount = e.target.value), + onInput: (e) => { + let v = e.target.value; + // Chrome emits scientific notation (e.g. "1e-8") when stepping tiny + // BTC amounts — normalize it back to a plain decimal string. + if (v && /e/i.test(v)) { + const n = Number(v); + if (isFinite(n)) { + v = s.unit === 'sats' ? String(Math.round(n)) : n.toFixed(8).replace(/\.?0+$/, ''); + e.target.value = v; + } + } + s.amount = v; + }, }), h( 'div', -- cgit v1.2.3