diff --git a/src/DateInput.jsx b/src/DateInput.jsx index 2dbfd8cb..323dae79 100644 --- a/src/DateInput.jsx +++ b/src/DateInput.jsx @@ -341,7 +341,7 @@ export default class DateInput extends PureComponent { return; } - const { value } = input; + const { maxLength, value } = input; const max = input.getAttribute('max'); const valueNumeric = Number(value); @@ -351,7 +351,7 @@ export default class DateInput extends PureComponent { * However, given 2, smallers possible number would be 20, and thus keeping the focus in * this field doesn't make sense. */ - if ((value * 10 > max) || (`${valueNumeric}`.length >= max.length)) { + if ((value * 10 > max) || (`${valueNumeric}`.length >= maxLength)) { const property = 'nextElementSibling'; const nextInput = findInput(input, property); focus(nextInput); diff --git a/src/DateInput/Input.jsx b/src/DateInput/Input.jsx index 9954c464..100248ef 100644 --- a/src/DateInput/Input.jsx +++ b/src/DateInput/Input.jsx @@ -133,6 +133,7 @@ export default function Input({ disabled={disabled} inputMode="numeric" max={max} + maxLength={`${max}`.length} min={min} name={name} onChange={onChange}