diff --git a/src/Service/UwNodeFieldValue.php b/src/Service/UwNodeFieldValue.php index c50515cbaa7ef4741fa707b104fc7715d0cc58be..21c749c19db2ab66d2b795c2153666d33c5909f2 100644 --- a/src/Service/UwNodeFieldValue.php +++ b/src/Service/UwNodeFieldValue.php @@ -694,6 +694,11 @@ class UwNodeFieldValue { $return_dates = []; + // If there is no dates to process, return empty array. + if (!$node->$field_name->value) { + return $return_dates; + } + // If this is not and event, just get the date. if ($node->getType() !== 'uw_ct_event') { $return_dates[] = $this->getDate([$node->$field_name->value], 'blog'); @@ -904,7 +909,15 @@ class UwNodeFieldValue { $return_date['end_date'] = $date['end_value']; } else { - $return_date['date'] = $date[0]; + + // If the date contains a time code, we need to convert + // it, because it is stored in UTC. + if (strpos($date[0], 'T')) { + $return_date['date'] = date('c', strtotime($date[0] . ' UTC')); + } + else { + $return_date['date'] = $date[0]; + } } return $return_date;