/** * Check dates. * * @return bool */ public function isValid() { if (!parent::isValid()) { return false; } if (!checkdate("-" . $this->getMonth(), $this->getDay(), $this->getYear())) { throw new Exception("invalid date: " . $this->__toString()); } return true; }
/** * Overload isValid to for additional date checks. * * @return bool */ public function isValid() { return checkdate($this->getMonth(), $this->getDay(), $this->getYear()) and parent::isValid(); }