Ext version tested:
  • Ext 3.3.3
Browser versions tested against:
  • Chrome 31
Description:
  • I set TimeField maxValue and minValue but it dose not work
Steps to reproduce the problem:
  • Timefield setting
Code:
{
fieldLabel:'Time',
xtype:'timefield',
minValue:'6:00 AM',
maxValue:'9:00 AM'
}
  • manual input 5:00 AM
The result that was expected:
  • time field show invalid-mark
The result that occurs instead:
  • time field does not show invalid-mark
Solution:
Code:

Code:
Ext.override(Ext.form.TimeField, {
	/**
	 * fix maxValue & minValue validation not work bug
	 */
	getErrors: function(value) {
		var errors = Ext.form.DateField.superclass.getErrors.apply(this, arguments);


		value = this.formatDate(value || this.processValue(this.getRawValue()));
		if (value.length < 1) { // if it's blank and textfield didn't flag it then it's valid
			return errors;
		}


		var svalue = value;
		value = this.parseDate(value);
		if (!value) {
			errors.push(String.format(this.invalidText, svalue, this.format));
			return errors;
		}


		var time = value.getTime();


		if (this.minValue && time < this.minValue.getTime()) {
			errors.push(String.format(this.minText, this.formatDate(this.minValue)));
		}


		if (this.maxValue && time > this.maxValue.getTime()) {
			errors.push(String.format(this.maxText, this.formatDate(this.maxValue)));
		}


		if (this.disabledDays) {
			var day = value.getDay();


			for (var i = 0; i < this.disabledDays.length; i++) {
				if (day === this.disabledDays[i]) {
					errors.push(this.disabledDaysText);
					break;
				}
			}
		}


		var fvalue = this.formatDate(value);
		if (this.disabledDatesRE && this.disabledDatesRE.test(fvalue)) {
			errors.push(String.format(this.disabledDatesText, fvalue));
		}


		return errors;
	}
});