From a8c575a16304cf43f334b732118acb40df56a071 Mon Sep 17 00:00:00 2001 From: "Michael J. Simons" Date: Thu, 16 Dec 2010 22:33:53 +0100 Subject: [PATCH] Added support for a date/time separator --- jquery-ui-timepicker-addon.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jquery-ui-timepicker-addon.js b/jquery-ui-timepicker-addon.js index 11834a9..f8d27fa 100644 --- a/jquery-ui-timepicker-addon.js +++ b/jquery-ui-timepicker-addon.js @@ -61,7 +61,8 @@ function Timepicker() { hourGrid: 0, minuteGrid: 0, secondGrid: 0, - alwaysSetTime: true + alwaysSetTime: true, + separator: ' ' }; $.extend(this._defaults, this.regional['']); } @@ -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)') @@ -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) { @@ -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;