src/Carbon/CarbonPeriod.php
public function setEndDate($date, $inclusive = null)
    {
        if (!is_null($date) && !$date = call_user_func([$this->dateClass, 'make'], $date)) {
            throw new InvalidArgumentException('Invalid end date.');
        }

        if (!$date) {
            return $this->removeFilter(static::END_DATE_FILTER);
        }

        $this->endDate = $date;

        if ($inclusive !== null) {
            $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive);
        }

        if (!$this->hasFilter(static::END_DATE_FILTER)) {
            return $this->addFilter(static::END_DATE_FILTER);
        }

        $this->handleChangedParameters();

        return $this;
    }
public function setEndDate($date, $inclusive = null)
    {
        if (!is_null($date) && !$date = call_user_func([$this->dateClass, 'make'], $date)) {
            throw new InvalidArgumentException('Invalid end date.');
        }

        if (!$date) {
            return $this->removeFilter(static::END_DATE_FILTER);
        }

        $this->endDate = $date;

        if ($inclusive !== null) {
            $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive);
        }

        if (!$this->hasFilter(static::END_DATE_FILTER)) {
            return $this->addFilter(static::END_DATE_FILTER);
        }

        $this->handleChangedParameters();

        return $this;
    }
public function setEndDate ( $ date , $ inclusive = null ) { if ( ! is_null ( $ date ) && ! $ date = call_user_func ( [ $ this -> dateClass , 'make' ] , $ date ) ) { throw new InvalidArgumentException ( 'Invalid end date.' ) ; } if ( ! $ date ) { return $ this -> removeFilter ( static :: END_DATE_FILTER ) ; } $ this -> endDate = $ date ; if ( $ inclusive !== null ) { $ this -> toggleOptions ( static :: EXCLUDE_END_DATE , ! $ inclusive ) ; } if ( ! $ this -> hasFilter ( static :: END_DATE_FILTER ) ) { return $ this -> addFilter ( static :: END_DATE_FILTER ) ; } $ this -> handleChangedParameters ( ) ; return $ this ; }
Change the period end date.

@param DateTime|DateTimeInterface|string|null $date
@param bool|null                              $inclusive

@throws \InvalidArgumentException

@return $this
Change the period end date .