You are here

public function DateRange::setEnd in Recurring Dates Field 8.2

Same name and namespace in other branches
  1. 3.x src/DateRange.php \Drupal\date_recur\DateRange::setEnd()
  2. 3.0.x src/DateRange.php \Drupal\date_recur\DateRange::setEnd()
  3. 3.1.x src/DateRange.php \Drupal\date_recur\DateRange::setEnd()

Set the end date.

Parameters

\DateTimeInterface $end: The end date.

Return value

$this Return object for chaining.

Throws

\InvalidArgumentException When there is a problem with the start and/or end date.

File

src/DateRange.php, line 91

Class

DateRange
Defines a date range.

Namespace

Drupal\date_recur

Code

public function setEnd(\DateTimeInterface $end) {

  // Clone to ensure references are lost.
  $this->end = clone $end;
  $this
    ->validateDates();
  return $this;
}