Skip to content

Commit 2aa96ed

Browse files
Merge pull request trentrichardson#167 from alexandergitter/dev
Add new regional setting timeSuffix
2 parents 30f54c8 + 1a50d4f commit 2aa96ed

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function Timepicker() {
3333
closeText: 'Done',
3434
ampm: false,
3535
timeFormat: 'hh:mm tt',
36+
timeSuffix: '',
3637
timeOnlyTitle: 'Choose Time',
3738
timeText: 'Time',
3839
hourText: 'Hour',
@@ -198,7 +199,7 @@ $.extend(Timepicker.prototype, {
198199
.replace(/s{1,2}/ig, '(\\d?\\d)')
199200
.replace(/t{1,2}/ig, '(am|pm|a|p)?')
200201
.replace(/z{1}/ig, '((\\+|-)\\d\\d\\d\\d)?')
201-
.replace(/\s/g, '\\s?') + '$',
202+
.replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
202203
order = this._getFormatPositions(),
203204
treg;
204205

@@ -624,7 +625,7 @@ $.extend(Timepicker.prototype, {
624625
if (this._defaults.ampm) this.ampm = ampm;
625626

626627
this._formatTime();
627-
if (this.$timeObj) this.$timeObj.text(this.formattedTime);
628+
if (this.$timeObj) this.$timeObj.text(this.formattedTime + this._defaults.timeSuffix);
628629
this.timeDefined = true;
629630
if (hasChanged) this._updateDateTime();
630631
},
@@ -699,7 +700,7 @@ $.extend(Timepicker.prototype, {
699700
if (this._defaults.timeOnly === true) {
700701
formattedDateTime = this.formattedTime;
701702
} else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
702-
formattedDateTime += this._defaults.separator + this.formattedTime;
703+
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
703704
}
704705

705706
this.formattedDateTime = formattedDateTime;
@@ -774,7 +775,7 @@ $.datepicker._selectDate = function (id, dateStr) {
774775
tp_inst._limitMinMaxDateTime(inst, true);
775776
inst.inline = inst.stay_open = true;
776777
//This way the onSelect handler called from calendarpicker get the full dateTime
777-
this._base_selectDate(id, dateStr + tp_inst._defaults.separator + tp_inst.formattedTime);
778+
this._base_selectDate(id, dateStr + tp_inst._defaults.separator + tp_inst.formattedTime + tp_inst._defaults.timeSuffix);
778779
inst.inline = inst.stay_open = false;
779780
this._notifyChange(inst);
780781
this._updateDatepicker(inst);
@@ -819,6 +820,7 @@ $.datepicker._doKeyPress = function(event) {
819820
.replace(/t/g, ampm ? 'ap' : '') +
820821
" " +
821822
tp_inst._defaults.separator +
823+
tp_inst._defaults.timeSuffix +
822824
$.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
823825
chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
824826
return event.ctrlKey || (chr < ' ' || !datetimeChars || datetimeChars.indexOf(chr) > -1);

0 commit comments

Comments
 (0)