Skip to content

Commit

Permalink
fix: ensure guessValidValueByRegExp does not set selection bigger tha…
Browse files Browse the repository at this point in the history
…n validated value length
  • Loading branch information
Andrey Belokopytov committed Nov 25, 2024
1 parent 44b9c67 commit 851652f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,13 @@ export function guessValidValueByRegExp(
return newPossibleValue.match(maskRegExp) ? newPossibleValue : validatedValuePart;
}, '');

if (newFrom > validatedValue.length) {
newFrom = validatedValue.length;
}

if (newTo > validatedValue.length) {
newTo = validatedValue.length;
}

return {value: validatedValue, selection: [newFrom, newTo]};
}

0 comments on commit 851652f

Please sign in to comment.