You are here

static function CalendarSystemsDrupalDateTime::convert in Calendar Systems 8.3

5 calls to CalendarSystemsDrupalDateTime::convert()
CalendarSystemsDateList::processDatelist in src/Element/CalendarSystemsDateList.php
Expands a date element into an array of individual elements.
CalendarSystemsDateTime::valueCallback in src/Element/CalendarSystemsDateTime.php
Determines how user input is mapped to an element's #value property.
CalendarSystemsDateTimeDatelistWidget::formElement in src/Plugin/Field/FieldWidget/CalendarSystemsDateTimeDatelistWidget.php
Returns the form for a single field widget.
CalendarSystemsDateTimeDefaultWidget::formElement in src/Plugin/Field/FieldWidget/CalendarSystemsDateTimeDefaultWidget.php
Returns the form for a single field widget.
CalendarSystemsTimestampDatetimeWidget::formElement in src/Plugin/Field/FieldWidget/CalendarSystemsTimestampDatetimeWidget.php
Returns the form for a single field widget.

File

src/CalendarSystems/CalendarSystemsDrupalDateTime.php, line 11

Class

CalendarSystemsDrupalDateTime

Namespace

Drupal\calendar_systems\CalendarSystems

Code

static function convert(DrupalDateTime $dateTime) : CalendarSystemsDrupalDateTime {
  $me = new CalendarSystemsDrupalDateTime($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;
}