Skip to content

Commit

Permalink
EWPP-1104: Fix date only.
Browse files Browse the repository at this point in the history
  • Loading branch information
drishu committed May 10, 2021
1 parent d5f9f1c commit 4beefce
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Drupal/Driver/Fields/Drupal8/DatetimeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ public function expand($values) {
// uses UTC for internal storage. If no timezone is specified in a date
// field value by the step author, assume the default timezone of
// 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') {
$date = new \DateTime($value);
$format = DateTimeItemInterface::DATE_STORAGE_FORMAT;
}
else {
$date = new \DateTime($value, $siteTimezone);
$date->setTimezone($storageTimezone);
$format = DateTimeItemInterface::DATETIME_STORAGE_FORMAT;
}
$values[$key] = $date->format($format);
}
}
return $values;
Expand Down

0 comments on commit 4beefce

Please sign in to comment.