if (isNaN(value) || options.dateOnly && value % 86400000 !== 0) {
err = options.notValid ||
options.message ||
this.notValid ||
"must be a valid date";
return v.format(err, {value: arguments[0]});
}
if (!isNaN(earliest) && value < earliest) {
err = options.tooEarly ||
options.message ||
this.tooEarly ||
"must be no earlier than %{date}";
err = v.format(err, {
value: this.format(value, options),
date: this.format(earliest, options)
});
errors.push(err);
}
if (!isNaN(latest) && value > latest) {
err = options.tooLate ||
options.message ||
this.tooLate ||
"must be no later than %{date}";
err = v.format(err, {
date: this.format(latest, options),
value: this.format(value, options)
});
errors.push(err);
}
if (errors.length) {
return v.unique(errors);
}
}, {
parse: null,
format: null
}),
date: function(value, options) {
options = v.extend({}, options, {dateOnly: true});
return v.validators.datetime.call(v.validators.datetime, value, options);
},
format: function(value, options) {
if (v.isString(options) || (options instanceof RegExp)) {
options = {pattern: options};
}
options = v.extend({}, this.options, options);
var message = options.message || this.message || "is invalid"
, pattern = options.pattern
, match;