I have a view of events, which has a start date and an end date (2 separate fields as the end date was added later). The end date is optional. I want to show events that are either in the future or are currently ongoing. So somehow I need to check if the node has an end date - and if so apply the filter on that, but if not then use the start date instead.

Is there any way to achieve this? Maybe I'm looking at in the wrong way.


Either you make end date field mandatory or use hook_views_query_alter to get ongoing or future events.

If you go with field mandatory option, you simply need to add two view filters with OR condition.

  1. Start date >= Today OR
  2. End date >=Today

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.