Skip to content
Snippets Groups Projects
Commit 3b42a698 authored by Eric Bremner's avatar Eric Bremner Committed by Eric Bremner
Browse files

ISTWCMS-4704: updating events to handle recurring dates

parent a6d3c410
No related branches found
No related tags found
1 merge request!112Feature/istwcms 4704 m26lebla ebremner content types
......@@ -243,18 +243,48 @@ class UWService implements UWServiceInterface {
break;
case 'date':
if ($node->getType() !== 'events') {
// If this is not and event, just get the date.
if ($node->getType() !== 'uw_ct_event') {
$node_data['date'] = date('l, F j, Y', strtotime($node->$data->value));
}
else {
// Get all the dates.
// @todo figure out what date to display for events.
$dates = $node->$data->getValue();
$node_data['date'] = date('l, F j, Y', $dates[0]['value']);
// Step through each of the dates and get
// out correct values.
foreach ($dates as $date) {
// The all day case, duration is always 1439.
if ($date['duration'] == '1439' && $date['end_value'] > strtotime("now")) {
$node_data['date'][] = date('l, F j, Y', $date['value']) . ' (all day)';
}
else {
// If the date is upcoming, meaning greater than right now.
if ($date['end_value'] > strtotime("now")) {
// If this is the same day, get the date and the start
// and end times.
if ($date['duration'] < '1439') {
$start_date = date('l, F j, Y g:i A', $date['value']);
$end_date = date('g:i A', $date['end_value']);
}
// This is not the day, get the start and end date with time.
else {
$start_date = date('l, F j, Y g:i A', $date['value']);
$end_date = date('l, F j, Y g:i A', $date['end_value']);
}
// Add the start and end date with timezone.
$node_data['date'][] = $start_date . ' - ' . $end_date . ' ' . date('T', $date['end_value']);
}
}
}
}
break;
case 'sources':
......
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