Fixed input behavior to remove the first '0' when entering a sum
This commit is contained in:
parent
1170b0bdc6
commit
78b91d2d7a
@ -122,7 +122,7 @@ export default function Payment() {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (Number(paymentValueField) < 900) {
|
||||
enqueueSnackbar("Минимальная сумма 900р");
|
||||
|
||||
@ -290,7 +290,10 @@ export default function Payment() {
|
||||
value: paymentValueField,
|
||||
type: "number",
|
||||
}}
|
||||
onChange={(e) => setPaymentValueField(e.target.value.replace(/^0+(?=\d\.)/, ""))}
|
||||
onChange={(e) => {
|
||||
const value = parseFloat(e.target.value.replace(/^0+(?=\d\.)/, ""));
|
||||
setPaymentValueField(isNaN(value) ? "" : value.toString());
|
||||
}}
|
||||
id="payment-amount"
|
||||
gap={upMd ? "16px" : "10px"}
|
||||
color={"#F2F3F7"}
|
||||
|
Loading…
Reference in New Issue
Block a user