You are here

public function RecurringPeriodBase::getPeriodFromDate in Recurring Time Period 8

Gets a period object that begins on a given date.

Parameters

\DateTimeImmutable $start: The date and time to begin the period from.

Return value

\Drupal\recurring_period\Datetime\Period The period value object.

Overrides RecurringPeriodInterface::getPeriodFromDate

1 call to RecurringPeriodBase::getPeriodFromDate()
RecurringPeriodBase::getNextPeriod in src/Plugin/RecurringPeriod/RecurringPeriodBase.php
Calculates the period after the given period.

File

src/Plugin/RecurringPeriod/RecurringPeriodBase.php, line 150

Class

RecurringPeriodBase
Base class for recurring period plugins.

Namespace

Drupal\recurring_period\Plugin\RecurringPeriod

Code

public function getPeriodFromDate(\DateTimeImmutable $start) {
  $end_date = $this
    ->calculateDate($start);
  $label = $this
    ->getPeriodLabel($start, $end_date);
  return new Period($start, $end_date, $label);
}