コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function validate($value)
 {
     $date = date_parse($value);
     if (!$date) {
         return false;
     }
     if (!checkdate($date['month'], $date['day'], $date['year'])) {
         return false;
     }
     $target = sprintf('%04d%02d%02d', $date['year'], $date['month'], $date['day']);
     if ($this->rule->getAllowCurrentDate() == true) {
         return $target <= date('Ymd');
     } else {
         return $target < date('Ymd');
     }
 }
コード例 #2
0
 public function date()
 {
     return ValidationConfig::create()->addRequired('必須入力です')->addPastDate('過去の日付を追加して下さい', PastDateRule::create()->setAllowCurrentDate(true));
 }