Permalink
Browse files

Fixed ampm constraint

  • Loading branch information...
1 parent 425b957 commit badcc050c44872d30d23a1fa5c8e3a75c0981f74 @doublerebel doublerebel committed Nov 21, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 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);

0 comments on commit badcc05

Please sign in to comment.