fix: Prevent multiple leading zeros in number input
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -658,6 +658,10 @@ function buttonPress(val) {
|
|||||||
isDecimal = false;
|
isDecimal = false;
|
||||||
} else {
|
} else {
|
||||||
currNumber = currNumber == null || hasPressedEquals === 1 ? val : (is0Negative ? '-' + val : currNumber + val);
|
currNumber = currNumber == null || hasPressedEquals === 1 ? val : (is0Negative ? '-' + val : currNumber + val);
|
||||||
|
// remove preceding 0 on integers
|
||||||
|
if (typeof currNumber === 'string' && currNumber.length > 1 && currNumber[0] === '0' && currNumber.indexOf('.') === -1) {
|
||||||
|
currNumber = currNumber.substr(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (hasPressedEquals === 1) {
|
if (hasPressedEquals === 1) {
|
||||||
hasPressedEquals = 2;
|
hasPressedEquals = 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user