|
98 | 98 | altAmpm: null,
|
99 | 99 | altSeparator: null,
|
100 | 100 | altTimeSuffix: null,
|
| 101 | + pickerTimeFormat: null, |
| 102 | + pickerTimeSuffix: null, |
101 | 103 | showTimepicker: true,
|
102 | 104 | timezoneIso8601: false,
|
103 | 105 | timezoneList: null,
|
|
731 | 733 | this.ampm = ampm;
|
732 | 734 | }
|
733 | 735 |
|
| 736 | + // Updates the time within the timepicker |
734 | 737 | this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
|
735 | 738 | if (this.$timeObj) {
|
736 |
| - this.$timeObj.text(this.formattedTime + o.timeSuffix); |
| 739 | + var pickerTimeFormat = this._defaults.pickerTimeFormat || this._defaults.timeFormat, |
| 740 | + pickerTimeSuffix = this._defaults.pickerTimeSuffix || this._defaults.timeSuffix; |
| 741 | + if(pickerTimeFormat === this._defaults.timeFormat){ |
| 742 | + this.$timeObj.text(this.formattedTime + pickerTimeSuffix); |
| 743 | + } |
| 744 | + else{ |
| 745 | + this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, this._defaults) + pickerTimeSuffix); |
| 746 | + } |
737 | 747 | }
|
| 748 | + |
738 | 749 | this.timeDefined = true;
|
739 | 750 | if (hasChanged) {
|
740 | 751 | this._updateDateTime();
|
|
1167 | 1178 | timezone: '+0000'
|
1168 | 1179 | }, time);
|
1169 | 1180 |
|
1170 |
| - var tmptime = format; |
1171 |
| - var ampmName = options.amNames[0]; |
1172 |
| - |
1173 |
| - var hour = parseInt(time.hour, 10); |
| 1181 | + var tmptime = format, |
| 1182 | + ampmName = options.amNames[0], |
| 1183 | + hour = parseInt(time.hour, 10); |
1174 | 1184 | if (options.ampm) {
|
1175 | 1185 | if (hour > 11) {
|
1176 | 1186 | ampmName = options.pmNames[0];
|
|
1179 | 1189 | tmptime = tmptime.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[lz]|('.*?'|".*?"))/g, function(match) {
|
1180 | 1190 | switch (match) {
|
1181 | 1191 | case 'HH':
|
1182 |
| - return _convert24to12(hour).slice(-2); |
| 1192 | + return ('0' + hour).slice(-2); |
1183 | 1193 | case 'H':
|
1184 |
| - return _convert24to12(hour); |
| 1194 | + return hour; |
1185 | 1195 | case 'hh':
|
1186 |
| - return ('0' + hour).slice(-2); |
| 1196 | + return _convert24to12(hour).slice(-2); |
1187 | 1197 | case 'h':
|
1188 |
| - return hour; |
| 1198 | + return _convert24to12(hour); |
1189 | 1199 | case 'mm':
|
1190 | 1200 | return ('0' + time.minute).slice(-2);
|
1191 | 1201 | case 'm':
|
|
1198 | 1208 | return ('00' + time.millisec).slice(-3);
|
1199 | 1209 | case 'z':
|
1200 | 1210 | return time.timezone === null? options.defaultTimezone : time.timezone;
|
| 1211 | + case 'T': |
| 1212 | + return ampmName.charAt(0).toUpperCase(); |
| 1213 | + case 'TT': |
| 1214 | + return ampmName.toUpperCase(); |
1201 | 1215 | case 't':
|
| 1216 | + return ampmName.charAt(0).toLowerCase(); |
1202 | 1217 | case 'tt':
|
1203 |
| - if (options.ampm) { |
1204 |
| - if (match.length == 1) { |
1205 |
| - ampmName = ampmName.charAt(0); |
1206 |
| - } |
1207 |
| - return match.charAt(0) === 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase(); |
1208 |
| - } |
1209 |
| - return ''; |
| 1218 | + return ampmName.toLowerCase(); |
1210 | 1219 | default:
|
1211 | 1220 | return match.replace(/\'/g, "") || "'";
|
1212 | 1221 | }
|
|
0 commit comments