'#date_timezone' =>
date_default_timezone_get(),
'#required' =>
$element['#required'
],
];
if ($this->
getFieldSetting('datetime_type'
) == DateTimeItem::DATETIME_TYPE_DATE
) { // A date-only field should have no timezone conversion performed, so
// use the same timezone as for storage.
$element['value'
]['#date_timezone'
] = DateTimeItemInterface::STORAGE_TIMEZONE;
} if ($items[$delta]->date
) { $element['value'
]['#default_value'
] =
$this->
createDefaultValue($items[$delta]->date,
$element['value'
]['#date_timezone'
]);
} return $element;
} /**
* {@inheritdoc}
*/
public function massageFormValues(array
$values, array
$form, FormStateInterface
$form_state) { // The widget form element type has transformed the value to a
// DrupalDateTime object at this point. We need to convert it back to the