Browse Source

Apply fix for #1003 to validateAttribute.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
b9f9b16536
  1. 3
      framework/yii/validators/DateValidator.php

3
framework/yii/validators/DateValidator.php

@ -56,7 +56,8 @@ class DateValidator extends Validator
return;
}
$date = DateTime::createFromFormat($this->format, $value);
if ($date === false) {
$errors = DateTime::getLastErrors();
if ($date === false || $errors['error_count'] || $errors['warning_count']) {
$this->addError($object, $attribute, $this->message);
} elseif ($this->timestampAttribute !== null) {
$object->{$this->timestampAttribute} = $date->getTimestamp();

Loading…
Cancel
Save