Exemplo n.º 1
0
 /**
  * @param InputValue $input
  * @throws ValidationException
  */
 public function process(InputValue $input)
 {
     $isDate = new IsDate();
     $isDate->process($input);
     $date = Utils::toDateObject($input->getValue());
     $toCompare = $this->getOption('time');
     if ($date >= $toCompare) {
         throw new ValidationException('Date should be before ' . $toCompare->format(\DateTime::ISO8601));
     }
 }
Exemplo n.º 2
0
 /**
  * @param InputValue $input
  * @throws ValidationException
  */
 public function process(InputValue $input)
 {
     $isDate = new IsDate();
     $isDate->process($input);
     $date = Utils::toDateObject($input->getValue());
     $time1 = $this->getOption('time1');
     $time2 = $this->getOption('time2');
     if ($date < $time1 || $date > $time2) {
         throw new ValidationException('Date should be between ' . $time1->format(\DateTime::ISO8601) . ' and ' . $time2->format(\DateTime::ISO8601));
     }
 }