code: public function setEndDate($endDate)
      {
          if ($endDate instanceof DateTime) {
              $this->endDate = $endDate;
          } else {
              try {
                  $this->endDate = new DateTime($endDate);
              } catch (\Exception $e) {
                  $this->endDate = null;
              }
          }
  
          return $this;
      }
docs: Sets the "endDate" of the User.
  
  @param DateTime $endDate
  
  @return User