Skip to content
Snippets Groups Projects
Unverified Commit 5d80d634 authored by git's avatar git Committed by Mateu Aguiló Bosch
Browse files

Issue #2953227 by vtcore: Date Time enhancer does not work with Date range fields

parent e24676b7
Branches
No related tags found
No related merge requests found
......@@ -19,6 +19,20 @@ class DateTimeFromStringEnhancer extends DateTimeEnhancerBase {
* {@inheritdoc}
*/
public function postProcess($value) {
if (is_array($value)) {
return array_map([$this, 'processSingleValue'], $value);
}
return $this->processSingleValue($value);
}
/**
* Process a single value
*
* @param $value
* @return string
*/
protected function processSingleValue($value) {
$storage_timezone = new \DateTimezone(DATETIME_STORAGE_TIMEZONE);
$date = new \DateTime($value, $storage_timezone);
......@@ -34,6 +48,20 @@ class DateTimeFromStringEnhancer extends DateTimeEnhancerBase {
* {@inheritdoc}
*/
public function prepareForInput($value) {
if (is_array($value)) {
return array_map([$this, 'prepareSingleValue'], $value);
}
return $this->prepareSingleValue($value);
}
/**
* Prepare a single value for input.
*
* @param $value
* @return string
*/
protected function prepareSingleValue($value) {
$date = new \DateTime($value);
// Adjust the date for storage.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment