- var me = this,
- picker = me.picker;
- me.setLimit(value, false);
- if (picker) {
- picker.setMaxValue(me.maxValue);
- }
- },
-
-<span id='Ext-form-field-Time-method-setLimit'> /**
-</span> * @private
- * Updates either the min or max value. Converts the user's value into a Date object whose
- * year/month/day is set to the {@link #initDate} so that only the time fields are significant.
- */
- setLimit: function(value, isMin) {
- var me = this,
- d, val;
- if (Ext.isString(value)) {
- d = me.parseDate(value);
- }
- else if (Ext.isDate(value)) {
- d = value;
- }
- if (d) {
- val = Ext.Date.clearTime(new Date(me.initDate));
- val.setHours(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
- me[isMin ? 'minValue' : 'maxValue'] = val;
- }
- },
-
- rawToValue: function(rawValue) {
- return this.parseDate(rawValue) || rawValue || null;
- },
-
- valueToRaw: function(value) {
- return this.formatDate(this.parseDate(value));
- },
-
-<span id='Ext-form-field-Time-method-getErrors'> /**
-</span> * Runs all of Time's validations and returns an array of any errors. Note that this first
- * runs Text's validations, so the returned array is an amalgamation of all field errors.
- * The additional validation checks are testing that the time format is valid, that the chosen
- * time is within the {@link #minValue} and {@link #maxValue} constraints set.
- * @param {Mixed} value The value to get errors for (defaults to the current field value)
- * @return {Array} All validation errors for this field
- */
- getErrors: function(value) {
- var me = this,
- format = Ext.String.format,
- errors = me.callParent(arguments),
- minValue = me.minValue,
- maxValue = me.maxValue,
- date;
-
- value = me.formatDate(value || me.processRawValue(me.getRawValue()));
-
- if (value === null || value.length < 1) { // if it's blank and textfield didn't flag it then it's valid
- return errors;
- }
-
- date = me.parseDate(value);
- if (!date) {
- errors.push(format(me.invalidText, value, me.format));
- return errors;
- }
-
- if (minValue && date < minValue) {
- errors.push(format(me.minText, me.formatDate(minValue)));
- }
-
- if (maxValue && date > maxValue) {
- errors.push(format(me.maxText, me.formatDate(maxValue)));
- }
-
- return errors;
- },
-
- formatDate: function() {
- return Ext.form.field.Date.prototype.formatDate.apply(this, arguments);