Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum call stack size exceeded at RegExp.toString when using date mask 'mm/dd/yyyy' and 'min' property #2754

Open
Techn1c4l opened this issue Nov 8, 2023 · 0 comments
Assignees
Milestone

Comments

@Techn1c4l
Copy link

This issue occurs only when certain conditions are met:

  1. Alias set to "datetime".
  2. Format is set to "mm/dd/yyyy" or similar beginning with "mm".
  3. "min" property is set to a date which month is greater than 9.
  4. You attempt to enter anything than "1", e.g. "2" or "3".

Those values are not valid, so I shouldn't be able to input them. Instead it hangs for a second and throws an error with following description:

inputmask.js:3180 Uncaught RangeError: Maximum call stack size exceeded
    at RegExp.toString (<anonymous>)
    at f (inputmask.js:3180:216)
    at inputmask.js:3282:61
    at c2 (inputmask.js:3302:33)
    at k (inputmask.js:3321:37)
    at y.p (inputmask.js:3344:33)
    at y.u (inputmask.js:3172:80)
    at y.c (inputmask.js:3159:42)
    at y.s (inputmask.js:3148:64)
    at t2.getMaskTemplate (inputmask.js:3112:40)

If you set a minimum month to 9 or less, the issue is not present.

Example page to reproduce:

<!DOCTYPE html>
<html lang="en-US">
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/5.0.8/jquery.inputmask.min.js"></script>
</head>
<body>
<form>
	<input type="text" id="field" ><label class="form-label" for="field"> Try to enter a month beginning with anything else than '1'</label>
</form>


<script>
window.onload = function () {
	jQuery("#field").inputmask( {"alias":"datetime","inputFormat":"mm/dd/yyyy","min":"10/25/2023","max":"11/25/2023"});
};
</script>
</body>
@RobinHerbots RobinHerbots added this to the 5.0.9 milestone Nov 8, 2023
@RobinHerbots RobinHerbots self-assigned this Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants