code: public function isValid()
      {
          // check that attribute aren't null
          if (
              $this->getFromDay() == null || $this->getFromHour() == null ||
              $this->getToDay() == null || $this->getToHour() == null
          ) {
              return false;
          }
  
          // check ranges
          if ($this->getFromDay()  < 1 || $this->getFromDay() > 31) {
              return false;
          }
          if ($this->getToDay() < 1 || $this->getToDay() > 31) {
              return false;
          }
          if ($this->getFromHour() > 24 || $this->getToHour() > 24) {
              return false;
          }
  
          if ($this->getFromDay() == $this->getToDay() && $this->getFromHour() >= $this->getToHour()) {
              return false;
          }
  
          return true;
      }
docs: Check if the forecast period is valid