Skip to content
Snippets Groups Projects
Commit 0b46c1f2 authored by Eric Bremner's avatar Eric Bremner Committed by Igor Biki
Browse files

ISTWCMS-4917: updating dates to check for query parameter and return any dates...

ISTWCMS-4917: updating dates to check for query parameter and return any dates greater than that parameter
parent e7e9105c
No related branches found
No related tags found
1 merge request!118Feature/istwcms 4917 ebremner upcoming dates
...@@ -607,13 +607,27 @@ class UWService implements UWServiceInterface { ...@@ -607,13 +607,27 @@ class UWService implements UWServiceInterface {
// Get all the dates. // Get all the dates.
$dates = $node->$field_name->getValue(); $dates = $node->$field_name->getValue();
// Get the date query parameter.
$date_parameter = \Drupal::request()->query->get('date');
// If there is a date query parameter, convert
// to timestamp so we can compare against dates
// in the event. If there is no parameter, set
// the timestamp todays date.
if ($date_parameter) {
$check_date = strtotime($date_parameter['value']);
}
else {
$check_date = strtotime("now");
}
// Step through each of the dates and get // Step through each of the dates and get
// out correct values. // out correct values.
foreach ($dates as $date) { foreach ($dates as $date) {
// Ensure that the dates are greater than now, before // Ensure that the dates are greater than timestamp
// adding it to the dates array. // that we generated above.
if ($date['end_value'] > strtotime("now")) { if ($date['end_value'] > $check_date) {
// The all day case, duration is always 1439. // The all day case, duration is always 1439.
if ($date['duration'] == '1439') { if ($date['duration'] == '1439') {
......
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