コード例 #1
0
ファイル: DateOrEmpty.php プロジェクト: mjaschen/collmex
 /**
  * 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);
 }
コード例 #2
0
ファイル: DateRange.php プロジェクト: clearidea/neuron
 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;
 }
コード例 #3
0
ファイル: Datetime.php プロジェクト: shushenghong/asphp
 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);
 }
コード例 #4
0
 /**
  * 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"));
 }
コード例 #5
0
ファイル: GeorgianDate.php プロジェクト: opilo/farsi
 /**
  * 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);
         }
     }
 }