Why doesn't jQuery datapicker limit input when setting date format?

I have an input field that is set as a date picker. When I initialize the dateFormat parameter, it stops the input restriction, and I can enter all kinds of garbage dates in the text box. Why is this happening? I would like to have limited input yet work when setting up a custom date format.

myTextInput.datepicker({ dateFormat: "dd-M-yy" });

If I do not set the dateFormat parameter, the input will be limited as expected.

+3
source share
1 answer

It is not a custom date format that violates it. It looks like when your dateFormat includes a string representation that it does not limit.

$('#mydate').datepicker({ dateFormat: "yy-mm-dd" });

.

, M, MM, D DD .

+3

Source: https://habr.com/ru/post/1754735/


All Articles