diff --git a/src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php b/src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php index 6250657..0d0cdb8 100644 --- a/src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php +++ b/src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php @@ -30,7 +30,13 @@ public function expand($values) { // the Drupal install, and therefore transform it into UTC for storage. $date = new DateTime($value, $siteTimezone); $date->setTimezone($storageTimezone); - $values[$key] = $date->format('Y-m-d\TH:i:s'); + if ($this->fieldInfo->getSetting('datetime_type') === 'date') { + $format = DateTimeItemInterface::DATE_STORAGE_FORMAT; + } + else { + $format = DateTimeItemInterface::DATETIME_STORAGE_FORMAT; + } + $values[$key] = $date->format($format); } } return $values;