Skip to content
Snippets Groups Projects
Commit 52639971 authored by Lily Yan's avatar Lily Yan
Browse files

Merge branch 'feature/ISTWCMS-5736-ebremner-fix-datetime' into '1.0.x'

ISTWCMS-5736: fixing dates with time

See merge request !258
parents 1d9d9844 35ad6eb5
No related branches found
No related tags found
1 merge request!258ISTWCMS-5736: fixing dates with time
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment