DateRecurDateTimeComputed.php in Recurring Dates Field 3.x
File
src/Plugin/Field/DateRecurDateTimeComputed.php
View source
<?php
declare (strict_types=1);
namespace Drupal\date_recur\Plugin\Field;
use Drupal\datetime\DateTimeComputed;
class DateRecurDateTimeComputed extends DateTimeComputed {
public function getValue() {
$hasValueBefore = isset($this->date);
parent::getValue();
if (!$hasValueBefore && isset($this->date)) {
$item = $this
->getParent();
$this->date
->setTimezone(new \DateTimeZone((string) $item->timezone));
}
return $this->date;
}
}