Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions jquery-ui-timepicker-addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function Timepicker() {
hourGrid: 0,
minuteGrid: 0,
secondGrid: 0,
alwaysSetTime: true
alwaysSetTime: true,
separator: ' '
};
$.extend(this._defaults, this.regional['']);
}
Expand Down Expand Up @@ -159,7 +160,7 @@ $.extend(Timepicker.prototype, {
// parse the time string from input value or _setTime
//########################################################################
_parseTime: function(timeString, withDate) {
var regstr = this._defaults.timeFormat.toString()
var regstr = this._defaults.separator + this._defaults.timeFormat.toString()
.replace(/h{1,2}/ig, '(\\d?\\d)')
.replace(/m{1,2}/ig, '(\\d?\\d)')
.replace(/s{1,2}/ig, '(\\d?\\d)')
Expand All @@ -173,7 +174,7 @@ $.extend(Timepicker.prototype, {
// the time should come after x number of characters and a space.
// x = at least the length of text specified by the date format
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
regstr = '.{' + dp_dateFormat.length + ',}\\s+' + regstr;
regstr = '.{' + dp_dateFormat.length + ',}\\s*?' + regstr;
}

if (treg) {
Expand Down Expand Up @@ -519,7 +520,7 @@ $.extend(Timepicker.prototype, {
if (this._defaults.timeOnly === true) formattedDateTime = this.formattedTime;
else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
if (this.$altInput) this.$altInput.val(this.formattedTime);
else formattedDateTime += ' ' + this.formattedTime;
else formattedDateTime += this._defaults.separator + this.formattedTime;
}

this.formattedDateTime = formattedDateTime;
Expand Down