Skip to content

Commit 4beefce

Browse files
committed
EWPP-1104: Fix date only.
1 parent d5f9f1c commit 4beefce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,16 @@ public function expand($values) {
2626
// uses UTC for internal storage. If no timezone is specified in a date
2727
// field value by the step author, assume the default timezone of
2828
// the Drupal install, and therefore transform it into UTC for storage.
29-
$date = new \DateTime($value, $siteTimezone);
30-
$date->setTimezone($storageTimezone);
31-
$values[$key] = $date->format('Y-m-d\TH:i:s');
29+
if ($this->fieldInfo->getSetting('datetime_type') === 'date') {
30+
$date = new \DateTime($value);
31+
$format = DateTimeItemInterface::DATE_STORAGE_FORMAT;
32+
}
33+
else {
34+
$date = new \DateTime($value, $siteTimezone);
35+
$date->setTimezone($storageTimezone);
36+
$format = DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
37+
}
38+
$values[$key] = $date->format($format);
3239
}
3340
}
3441
return $values;

0 commit comments

Comments
 (0)