Changed _doKeyPress to limit input characters correctly
based on timeFormat + a space + dateFormat (now restricts am/pm correctly based on timeFormat)
This commit is contained in:
parent
ba7074fba1
commit
95a6ef2f44
9
jquery-ui-timepicker-addon.js
vendored
9
jquery-ui-timepicker-addon.js
vendored
|
@ -608,9 +608,14 @@ $.datepicker._doKeyPress = function(event) {
|
|||
|
||||
if (tp_inst) {
|
||||
if ($.datepicker._get(inst, 'constrainInput')) {
|
||||
var datetimeChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')) + "aAmMpP :",
|
||||
var datetimeChars = tp_inst._defaults.timeFormat.toString()
|
||||
.replace(/[hms]/g, '')
|
||||
.replace(/TT|T/g, 'APM')
|
||||
.replace(/tt|t/g, 'apm') +
|
||||
" " +
|
||||
$.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
|
||||
chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
|
||||
return event.ctrlKey || (chr < ' ' || !dateChars || dateChars.indexOf(chr) > -1);
|
||||
return event.ctrlKey || (chr < ' ' || !datetimeChars || datetimeChars.indexOf(chr) > -1);
|
||||
}
|
||||
} else return $.datepicker._base_doKeyPress(event);
|
||||
|
||||
|
|
Loading…
Reference in a new issue