Allow leading zeros for decimal numbers in DurationInput

This commit is contained in:
Giuseppe Criscione 2020-12-12 19:54:33 +01:00
parent ca438fa3b7
commit 7a02f7e961
2 changed files with 3 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -136,8 +136,8 @@ export default function DurationInput(input, options) {
}
innerInputs[name] = innerInput;
innerInput.addEventListener('input', function () {
if (this.value.length > 1) {
this.value = this.value.replace(/^0+/, '');
while (this.value.charAt(0) === '0' && this.value.length > 1 && !this.value.charAt(1).match(/[.,]/)) {
this.value = this.value.slice(1);
}
while (this.value > Utils.getMaxSafeInteger()) {
this.value = this.value.slice(0, -1);