Skip to content
Snippets Groups Projects
Commit c26277c2 authored by Vitalii Koval's avatar Vitalii Koval Committed by Taras Kruts
Browse files

Issue #3276434 by Koval: Add condition if all day is activated and current...

Issue #3276434 by Koval: Add condition if all day is activated and current date is equal to the end date
parent ac964d1e
No related branches found
No related tags found
No related merge requests found
......@@ -36,8 +36,16 @@ trait SocialEventTrait {
return FALSE;
}
// The event has finished if the end date is smaller than the current date.
return $current_time->getTimestamp() > $check_end_date->getTimestamp();
// Check if is activated all_day checkbox.
$check_all_day = !$node->get('field_event_all_day')->isEmpty()
? $node->get('field_event_all_day')->getString()
: NULL;
// The event has finished if the end date is smaller than the current date,
// and if the all day checkbox isn't activated,
// and the end date is not equal to the current date.
return $current_time->getTimestamp() > $check_end_date->getTimestamp() &&
!($check_all_day && $check_end_date->format('Y-m-d') === $current_time->format('Y-m-d'));
}
}
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