Merge changes from Michael Simons for separator options

This commit is contained in:
Trent Richardson 2010-12-17 08:59:44 -05:00
commit b4805d6dcc

View file

@ -65,7 +65,8 @@ function Timepicker() {
hourGrid: 0, hourGrid: 0,
minuteGrid: 0, minuteGrid: 0,
secondGrid: 0, secondGrid: 0,
alwaysSetTime: true alwaysSetTime: true,
separator: ' '
}; };
$.extend(this._defaults, this.regional['']); $.extend(this._defaults, this.regional['']);
} }
@ -169,7 +170,7 @@ $.extend(Timepicker.prototype, {
// parse the time string from input value or _setTime // parse the time string from input value or _setTime
//######################################################################## //########################################################################
_parseTime: function(timeString, withDate) { _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(/h{1,2}/ig, '(\\d?\\d)')
.replace(/m{1,2}/ig, '(\\d?\\d)') .replace(/m{1,2}/ig, '(\\d?\\d)')
.replace(/s{1,2}/ig, '(\\d?\\d)') .replace(/s{1,2}/ig, '(\\d?\\d)')
@ -184,7 +185,7 @@ $.extend(Timepicker.prototype, {
// the time should come after x number of characters and a space. // the time should come after x number of characters and a space.
// x = at least the length of text specified by the date format // x = at least the length of text specified by the date format
var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
regstr = '.{' + dp_dateFormat.length + ',}\\s+' + regstr; regstr = '.{' + dp_dateFormat.length + ',}\\s*?' + regstr;
} }
treg = timeString.match(new RegExp(regstr, 'i')); treg = timeString.match(new RegExp(regstr, 'i'));
@ -597,6 +598,7 @@ $.extend(Timepicker.prototype, {
if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
return; return;
<<<<<<< HEAD
if (this._defaults.timeOnly === true) { if (this._defaults.timeOnly === true) {
formattedDateTime = this.formattedTime; formattedDateTime = this.formattedTime;
if (this.$altInput) { if (this.$altInput) {
@ -611,6 +613,12 @@ $.extend(Timepicker.prototype, {
} }
} }
formattedDateTime += ' ' + this.formattedTime; formattedDateTime += ' ' + this.formattedTime;
=======
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._defaults.separator + this.formattedTime;
>>>>>>> michael-simons-master
} }
this.formattedDateTime = formattedDateTime; this.formattedDateTime = formattedDateTime;