Hi,
I have implemented a front-end filter of events - see the right hand side of this page:
hidden link
The problem is that the start date IS working but the end date ISN'T - results are returned with a date greater than than the end date.
The filters are (key bit in bold):
Select posts with custom fields: wpcf-eventdate <b>BETWEEN URL_PARAM(startdatedate),URL_PARAM(enddatedate)</b> OR wpcf-eventgroup = URL_PARAM(group) OR wpcf-eventtype = URL_PARAM(type) OR wpcf-eventheme = URL_PARAM(theme)
Both the start and end date params are looking at the same Types date field.
I have set the BETWEEN operation as NUMERIC, as DATE doesn't seem to work.
The Meta HTML for the front-end filters is:
[wpv-filter-start hide="true"]
[wpv-filter-controls]
<div id="filtercontrols">
<p class="filterlabel">LOCATION</p><p>[wpv-control field="eventgroup" url_param="group"]</p>
<p class="filterlabel">THEME</p><p>[wpv-control field="eventheme" url_param="theme"]</p>
<p class="filterlabel">EVENT TYPE</p><p>[wpv-control field="eventtype" url_param="type"]</p>
<p class="filterlabel">FROM [wpv-control field="eventdate" type="datepicker" date_format="" url_param="startdatedate"]</p>
<p class="filterlabel">TO [wpv-control field="eventdate" type="datepicker" date_format="" url_param="enddatedate"]</p>
<p>[wpv-filter-submit name="SEARCH EVENTS"]</p>
</div>
[/wpv-filter-controls]
[wpv-pagination]
<p>[wpml-string context="wpv-views"]Showing page [wpv-pager-current-page] of [wpv-pager-num-page][/wpml-string] [wpv-pager-prev-page][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page] [wpv-pager-next-page][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]</p>
[/wpv-pagination]
[wpv-filter-end]
Am I doing something wrong or is this a bug?
Thanks, Simon
Dear Simon,
Because you have OR between your conditions, records that match any of the other conditions will be displayed. Even if the date is outside of the range. Try using AND and you will only get those emtries between the dates.
Please let me know if there is anything else that I can assist you with.
Regards,
Caridad
It still seems odd to me that it's observing the start date but not the end date. If it's because it's an OR search, surely it would return ALL results, not just those after the start date...?
Dear Simon,
Just for testing, disable the other controls temporarily and leave just the date controls. Let see if it makes sense that way, this should show you only records between those dates.
Please let me know if there is anything else that I can assist you with.
Regards,
Caridad