diff options
author | Trent Richardson <trentdrichardson@gmail.com> | 2012-07-24 10:15:21 -0400 |
---|---|---|
committer | Trent Richardson <trentdrichardson@gmail.com> | 2012-07-24 10:15:21 -0400 |
commit | 8c229ad2c47a36533d525141a50aa4dfae5152b1 (patch) | |
tree | 3ed02362e4bd01815086737e3d84f5b4995999a8 | |
parent | c685a069e86ab679230925aca237df67f6832a25 (diff) | |
download | jQuery-Timepicker-Addon-8c229ad2c47a36533d525141a50aa4dfae5152b1.zip jQuery-Timepicker-Addon-8c229ad2c47a36533d525141a50aa4dfae5152b1.tar.gz jQuery-Timepicker-Addon-8c229ad2c47a36533d525141a50aa4dfae5152b1.tar.bz2 |
Fixes ampm issue and parsing string literals, issues #383 and #394
-rw-r--r-- | jquery-ui-timepicker-addon.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 659511f..be94d14 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -41,8 +41,8 @@ function Timepicker() { currentText: 'Now', closeText: 'Done', ampm: false, - amNames: ['am', 'a'], - pmNames: ['pm', 'p'], + amNames: ['AM', 'A'], + pmNames: ['PM', 'P'], timeFormat: 'hh:mm tt', timeSuffix: '', timeOnlyTitle: 'Choose Time', @@ -975,7 +975,7 @@ $.datepicker.parseTime = function(timeFormat, timeString, options) { ampm = ''; resTime.ampm = ''; } else { - ampm = $.inArray(treg[order.t], o.amNames) !== -1 ? 'AM' : 'PM'; + ampm = $.inArray(treg[order.t].toUpperCase(), o.amNames) !== -1 ? 'AM' : 'PM'; resTime.ampm = o[ampm == 'AM' ? 'amNames' : 'pmNames'][0]; } } @@ -1055,7 +1055,7 @@ $.datepicker.formatTime = function(format, time, options) { hour = 12; } } - tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g, function(match) { + tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) { switch (match.toLowerCase()) { case 'hh': return ('0' + hour).slice(-2); case 'h': return hour; @@ -1073,6 +1073,8 @@ $.datepicker.formatTime = function(format, time, options) { return match.charAt(0) === 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase(); } return ''; + default: + return match.replace(/\'/g, "") || "'"; } }); |