From badcc050c44872d30d23a1fa5c8e3a75c0981f74 Mon Sep 17 00:00:00 2001 From: doublerebel Date: Sat, 20 Nov 2010 18:46:20 -0800 Subject: [PATCH] Fixed ampm constraint --- jquery-ui-timepicker-addon.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 1263f0f..01413ba 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -608,10 +608,13 @@ $.datepicker._doKeyPress = function(event) { if (tp_inst) { if ($.datepicker._get(inst, 'constrainInput')) { - var datetimeChars = tp_inst._defaults.timeFormat.toString() + var ampm = tp_inst._defaults.ampm, + datetimeChars = tp_inst._defaults.timeFormat.toString() .replace(/[hms]/g, '') - .replace(/TT|T/g, tp_inst._defaults.ampm ? 'APM' : '') - .replace(/tt|t/g, tp_inst._defaults.ampm ? 'apm' : '') + + .replace(/TT/g, ampm ? 'APM' : '') + .replace(/T/g, ampm ? 'AP' : '') + .replace(/tt/g, ampm ? 'apm' : '') + .replace(/t/g, ampm ? 'ap' : '') + " " + $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')), chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);