You are here

public function PriceList::setEndDate in Commerce Pricelist 8.2

Same name and namespace in other branches
  1. 8 src/Entity/PriceList.php \Drupal\commerce_pricelist\Entity\PriceList::setEndDate()

Sets the end date.

Parameters

\Drupal\Core\Datetime\DrupalDateTime $end_date: The end date.

Return value

$this

Overrides PriceListInterface::setEndDate

File

src/Entity/PriceList.php, line 229

Class

PriceList
Defines the Price list entity.

Namespace

Drupal\commerce_pricelist\Entity

Code

public function setEndDate(DrupalDateTime $end_date = NULL) {
  $this
    ->get('end_date')->value = NULL;
  if ($end_date) {
    $this
      ->get('end_date')->value = $end_date
      ->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
  }
  return $this;
}