You are here

static function DatexDrupalDateTime::convert in Datex 8

5 calls to DatexDrupalDateTime::convert()
DatexDateList::processDatelist in src/Element/DatexDateList.php
Expands a date element into an array of individual elements.
DatexDateTime::valueCallback in src/Element/DatexDateTime.php
Determines how user input is mapped to an element's #value property.
DatexDateTimeDatelistWidget::formElement in src/Plugin/Field/FieldWidget/DatexDateTimeDatelistWidget.php
Returns the form for a single field widget.
DatexDateTimeDefaultWidget::formElement in src/Plugin/Field/FieldWidget/DatexDateTimeDefaultWidget.php
Returns the form for a single field widget.
DatexTimestampDatetimeWidget::formElement in src/Plugin/Field/FieldWidget/DatexTimestampDatetimeWidget.php
Returns the form for a single field widget.

File

src/Datex/DatexDrupalDateTime.php, line 58

Class

DatexDrupalDateTime

Namespace

Drupal\datex\Datex

Code

static function convert(DrupalDateTime $dateTime) : DatexDrupalDateTime {
  $me = new DatexDrupalDateTime($dateTime
    ->getTimestamp(), $dateTime
    ->getTimezone(), [
    'langcode' => $dateTime->langcode,
  ]);
  $me->formatTranslationCache = $dateTime->formatTranslationCache;
  $me->stringTranslation = $dateTime->stringTranslation;
  $me->inputTimeRaw = $dateTime->inputTimeRaw;
  $me->inputTimeAdjusted = $dateTime->inputTimeAdjusted;
  $me->inputTimeZoneRaw = $dateTime->inputTimeZoneRaw;
  $me->inputTimeZoneAdjusted = $dateTime->inputTimeZoneAdjusted;
  $me->inputFormatRaw = $dateTime->inputFormatRaw;
  $me->inputFormatAdjusted = $dateTime->inputFormatAdjusted;
  $me->langcode = $dateTime->langcode;
  $me->errors = $dateTime->errors;
  $me->dateTimeObject = $dateTime->dateTimeObject;
  $me
    ->setTimestamp($dateTime
    ->getTimestamp());
  return $me;
}