diff --git a/etemplate/js/et2_core_inputWidget.js b/etemplate/js/et2_core_inputWidget.js index eb762eb386..6e1a8fad12 100644 --- a/etemplate/js/et2_core_inputWidget.js +++ b/etemplate/js/et2_core_inputWidget.js @@ -285,7 +285,7 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener], // Check for required if(this.options && this.options.needed && !this.options.readonly && (this.getValue() == null || this.getValue().valueOf() == '')) { - messages.push(this.egw().lang('input required')); + messages.push(this.egw().lang('Field must not be empty !!!')); ok = false; } return ok; diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index 4086f65ec8..b8530891d2 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -83,6 +83,7 @@ var et2_date = et2_inputWidget.extend( var self = this; this.input_date.bind('change', function(e){ self.set_value(this.value); + return false; }); // Framewok skips nulls, but null needs to be processed here @@ -128,8 +129,28 @@ var et2_date = et2_inputWidget.extend( } return; } else { - this.date = new Date(jQuery.datepicker.parseDateTime(this.input_date.datepicker('option', 'dateFormat'), - this.input_date.datepicker('option', 'timeFormat'), _value)); + try { + // silently fix skiped minutes or times with just one digit, as parser is quite pedantic ;-) + var fix_reg = / ([0-9]+)(:[0-9]*)?( ?(a|p)m?)?$/i; + var matches = _value.match(fix_reg); + if (matches && (matches[1].length < 2 || matches[2] === undefined || matches[2].length < 3 || + matches[3] && matches[3] != 'am' && matches[3] != 'pm')) + { + if (matches[1].length < 2 && !matches[3]) matches[1] = '0'+matches[1]; + if (matches[2] === undefined) matches[2] = ':00'; + while (matches[2].length < 3) matches[2] = ':0'+matches[2].substr(1); + _value = _value.replace(fix_reg, ' '+matches[1]+matches[2]+matches[3]); + if (matches[4] !== undefined) matches[3] = matches[4].toLowerCase() == 'a' ? 'am' : 'pm'; + } + var parsed = jQuery.datepicker.parseDateTime(this.input_date.datepicker('option', 'dateFormat'), + this.input_date.datepicker('option', 'timeFormat'), _value); + this.date = new Date(parsed); + this.set_validation_error(false); + } + catch(e) { + this.set_validation_error(this.egw().lang("'%1' has an invalid format !!!",_value)); + return; + } } } else if (typeof _value == 'object' && _value.date) { this.date = _value.date; diff --git a/phpgwapi/js/jsapi/egw_calendar.js b/phpgwapi/js/jsapi/egw_calendar.js index 4a7f5c010e..45ec411ab8 100644 --- a/phpgwapi/js/jsapi/egw_calendar.js +++ b/phpgwapi/js/jsapi/egw_calendar.js @@ -49,7 +49,8 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { function timePreferences(_egw) { return { - "timeFormat": egw.preference("timeformat") == 12 ? "h:mm tt" : "HH:mm", + // timepicker does NOT work with spaces in timeformat + "timeFormat": egw.preference("timeformat") == 12 ? "h:mmtt" : "HH:mm", "ampm": (egw.preference("timeformat") == "12"), "hourGrid": 4, "minuteGrid": 10 @@ -87,8 +88,8 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { onClose: function(date_text, picker) { // Only update if there's a change - "" if no date selected if(date_text != "") self.set_value(new Date( - picker.selectedYear, - picker.selectedMonth, + picker.selectedYear, + picker.selectedMonth, picker.selectedDay, self.input_hours ? self.input_hours.val() : 0, self.input_minutes ? self.input_minutes.val() : 0, @@ -119,10 +120,10 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { "currentText": false, "prevText": false, "closeText": false, - - // These ones are arrays. + + // These ones are arrays. // Integers are length. If lang() has no short translation, just trim full - "dayNames": false, + "dayNames": false, "dayNamesShort":3, "dayNamesMin": 2, "monthNames": false, @@ -201,11 +202,11 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { var ready = this.module('ready', _wnd); ready.ready(translateCalendar,this); ready.ready(translateTimepicker,this); - + return { /** * setup a calendar / date-selection - * + * * @member of egw * @param _input * @param _time @@ -218,7 +219,7 @@ egw.extend('calendar', egw.MODULE_WND_LOCAL, function(_app, _wnd) { }, /** * setup a time-selection - * + * * @param _input * @param _callback * @param _context