Skip to content
Snippets Groups Projects
Commit 245fb372 authored by Martin Leblanc's avatar Martin Leblanc
Browse files

Merge branch 'feature/ISTWCMS-4700-ebremner-fix-event-dates' into '1.0.x'

ISTWCMS-4700: fixing dates in events

See merge request !233
parents 7f4285af ab59834b
No related branches found
No related tags found
1 merge request!233ISTWCMS-4700: fixing dates in events
......@@ -738,6 +738,19 @@ class UwNodeFieldValue {
}
}
// If the dates are an array and there is more than one,
// sort the array so that the dates appear in order.
if (
is_array($return_dates) &&
count($return_dates) > 1
) {
// Sorting the array by the start date, so that
// the dates actually appear in the correct order.
$keys = array_column($return_dates, 'start_date');
array_multisort($keys, SORT_ASC, $return_dates);
}
return $return_dates;
}
......@@ -868,23 +881,25 @@ class UwNodeFieldValue {
if ($type == 'event') {
// If this is the same day, get the date and the start and end times.
if ($date['duration'] < '1439') {
$return_date['all_day'] = FALSE;
$return_date['date_range'] = TRUE;
$return_date['same_day'] = TRUE;
$return_date['start_date'] = $date['value'];
$return_date['end_date'] = $date['end_value'];
}
// This is not the day, get the start and end date with time.
elseif ($date['duration'] > '1439') {
$return_date['all_day'] = FALSE;
$return_date['date_range'] = TRUE;
$return_date['same_day'] = FALSE;
$return_date['start_date'] = $date['value'];
$return_date['end_date'] = $date['end_value'];
}
// The all date case, duration is always 1439.
else {
$return_date['all_day'] = TRUE;
$return_date['date'] = $date['value'];
$return_date['date_range'] = TRUE;
$return_date['same_day'] = FALSE;
}
$return_date['start_date'] = $date['value'];
$return_date['end_date'] = $date['end_value'];
}
else {
$return_date['date'] = $date[0];
......
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