Skip to content

Commit b4805d6

Browse files
Merge changes from Michael Simons for separator options
2 parents ee16a9a + a8c575a commit b4805d6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

jquery-ui-timepicker-addon.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ function Timepicker() {
6565
hourGrid: 0,
6666
minuteGrid: 0,
6767
secondGrid: 0,
68-
alwaysSetTime: true
68+
alwaysSetTime: true,
69+
separator: ' '
6970
};
7071
$.extend(this._defaults, this.regional['']);
7172
}
@@ -169,7 +170,7 @@ $.extend(Timepicker.prototype, {
169170
// parse the time string from input value or _setTime
170171
//########################################################################
171172
_parseTime: function(timeString, withDate) {
172-
var regstr = this._defaults.timeFormat.toString()
173+
var regstr = this._defaults.separator + this._defaults.timeFormat.toString()
173174
.replace(/h{1,2}/ig, '(\\d?\\d)')
174175
.replace(/m{1,2}/ig, '(\\d?\\d)')
175176
.replace(/s{1,2}/ig, '(\\d?\\d)')
@@ -184,7 +185,7 @@ $.extend(Timepicker.prototype, {
184185
// the time should come after x number of characters and a space.
185186
// x = at least the length of text specified by the date format
186187
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
187-
regstr = '.{' + dp_dateFormat.length + ',}\\s+' + regstr;
188+
regstr = '.{' + dp_dateFormat.length + ',}\\s*?' + regstr;
188189
}
189190

190191
treg = timeString.match(new RegExp(regstr, 'i'));
@@ -597,6 +598,7 @@ $.extend(Timepicker.prototype, {
597598
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
598599
return;
599600

601+
<<<<<<< HEAD
600602
if (this._defaults.timeOnly === true) {
601603
formattedDateTime = this.formattedTime;
602604
if (this.$altInput) {
@@ -611,6 +613,12 @@ $.extend(Timepicker.prototype, {
611613
}
612614
}
613615
formattedDateTime += ' ' + this.formattedTime;
616+
=======
617+
if (this._defaults.timeOnly === true) formattedDateTime = this.formattedTime;
618+
else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
619+
if (this.$altInput) this.$altInput.val(this.formattedTime);
620+
else formattedDateTime += this._defaults.separator + this.formattedTime;
621+
>>>>>>> michael-simons-master
614622
}
615623

616624
this.formattedDateTime = formattedDateTime;

0 commit comments

Comments
 (0)