You are here

protected function DateRecurRRule::massageOccurrence in Recurring Dates Field 8

Parameters

\DateTime $occurrence:

bool|TRUE $display:

Return value

array[[value => DrupalDateTime, end_value => DrupalDateTime], ...]

3 calls to DateRecurRRule::massageOccurrence()
DateRecurRRule::createOccurrences in src/DateRecurRRule.php
DateRecurRRule::current in src/DateRecurRRule.php
Return the current element
DateRecurRRule::next in src/DateRecurRRule.php
Move forward to next element

File

src/DateRecurRRule.php, line 299

Class

DateRecurRRule

Namespace

Drupal\date_recur

Code

protected function massageOccurrence(\DateTime $occurrence, $display = TRUE) {

  /** @var DateTimePlus $date */
  $date = DrupalDateTime::createFromFormat('Ymd H:i', $occurrence
    ->format('Ymd') . ' ' . $this->recurTime, $this->startDate
    ->getTimezone());
  if ($display) {
    $date = $this
      ->adjustDateForDisplay($date);
  }
  $date_end = clone $date;
  if (!empty($this->recurDiff)) {
    $date_end = $date_end
      ->add($this->recurDiff);
  }
  return [
    'value' => $date,
    'end_value' => $date_end,
  ];
}