code: public function isDateSelected()
      {
          $value = $this->datePicker(['getDate']);
          $initial = $this->execute($this->date);
  
          // By some reasons DatePicker could not return a date using "getDate" method
          // and we'll try to use it from input value directly. An issue could occur
          // after saving the form and/or reloading the page.
          if (empty($value)) {
              $value = $this->execute(self::jsDate($this->element->getValue()));
          }
  
          self::debug(['Comparing "%s" with "%s".'], [$value, $initial]);
  
          if ($value !== $initial) {
              throw new \Exception(sprintf('DatePicker contains the "%s" but should "%s".', $value, $initial));
          }
  
          return $this;
      }
docs: @throws \Exception
  
  @return self