/** * Validates a date value * * Collmex date representation: `YYYYMMDD` * * @param mixed $value * @param array $options * * @return bool Validation success */ public function validate($value, $options = array()) { if (empty($value)) { return true; } return parent::validate($value, $options); }
protected function validate($date) { if (!parent::validate($date)) { return false; } $startTS = strtotime($this->_sMinDate); $endTS = strtotime($this->_sMaxDate); $dateTS = strtotime($date); return $dateTS >= $startTS && $dateTS <= $endTS; }
public function validate($fieldName, $value) { if ($this->isEmpty($value)) { return true; } if (empty($this->params)) { $this->params = array(); } if (!isset($this->params['format'])) { $this->params['format'] = 'Y-m-d H:i:s'; } return parent::validate($fieldName, $value); }
/** * Generated from @assert ("2015.02.29") === false. * @group validate * @covers pgn\tags\Date::validate */ public function testValidate47() { $this->assertSame(false, $this->object->validate("2015.02.29")); }
/** * Validates the constructed date. * * @throws InvalidDateException */ protected function validate() { parent::validate(); $d = $this->getDay(); $m = $this->getMonth(); if ($d > static::$daysInMonth[$m - 1]) { if (!($m == 2 && $d == 29 && static::isLeapYear($this->getYear()))) { throw new InvalidDateException($this); } } }