2

I am using the Venti Events Calendar Plugin. I was wondering how I could go about searching for events between 2 dates.

I can display events between 2 dates below, using the .between parameter. But I have not figured out how to incorporate this into a search.

{% set events = craft.venti.events.between('2016-04-01 00:00:00','2016-05-19 00:00:00') %}

1 Answer 1

2

I managed to figure this out on my own. There's a good chance this solution will work for searching for entries between custom date fields using Craft's standard entry system (not the Venti Plugin) as well.

 {% set start = craft.request.param('startMonth') %}
 {% set end = craft.request.param('endMonth') %}
 {% set entries = craft.venti.events.startDate('and', '>= ' ~ start|date('Y-m-d'), '<= ' ~ end|date('Y-m-d')) %}

 {% for entry in entries %}
      <p>{{ entry.title }}</p>
 {% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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