I have an 'whatsOn' structure whose entries include two date fields: 'dateStart' and 'dateEnd'. The end date will be empty if the event is a one-dayer. I want to get all future events using the dateEnd (if not empty) or dateStart if not. So basically, all events that haven't ended yet. How do I add the 'dateEnd' bit to the following query:
{% set allEvents = craft.entries({
section: 'whatsOn',
limit: 20,
level: 2,
order: 'dateStart',
dateStart: '>= ' ~ now
}) %}
Crucially, I'll be paginating them so I need this to return an ElementCriteriaModel, I can't just do the check inside a loop.
EDIT: I just noticed that date fields are just empty (not null/undefined) if you don't select or enter a date. Amended question to reflect this.