I have a query over the out of the box approach used to control the max and min properties of a MVC DatePicker. I am using the Q3 2014 release and Kendo validation with MVC 5.
Without applying the .Max() or .Min() attributes, here is what we have being rendered out of the box:
Date(1900, 0, 1, 0, 0, 0, 0),
Date(2099, 11, 31, 0, 0, 0, 0)
This does correctly apply the range to the picker element - it is not possible to use this to input a date outside this range. However, the effect of this on the keyboard input is altogether different.
- If I type in a date within the range, i.e. 01/01/2000, but then add an extra digit to the year, this will be automatically truncated. So 01/01/20000 becomes 01/01/2000.
- However, if I type in a date which falls outside the min/max range, i.e. 01/01/1800 and then add an extra digit, nothing happens.
Surely this approach is very inconsistent? Why have the autocorrect functionality at all if it is only applied within the range?
I have read other responses to similar queries (Kendo DatePicker Max and Min values not limiting text entry
). The suggestion there was to make the input control read only to achieve the desired behaviour (meaning that only the picker can be used). Surely this isn't really acceptable from an accessibility point of view?
I would also have expected the date control to be able to enforce the Max and Min values which are part of its own API - for both keyboard and the picker? There is obviously some script running which recognises it is within or without the range - or else why do we observe the behaviour above?