I have a content type "event" with start_date and end_date (fields by date module).
A View lists this events and I need a custom exposed filter with a SELECT with 3 options:
- -All-
- Today
- In the next 15 day
- Next month
With the following comparison:
Today (start_date <= NOW && end_date >= NOW)
In the next 15 days (start_date <= NOW+15day && end_date >= NOW)
Next month (start_date <= $next_month_last_day && end_date >= $next_month_first_day)
What is the best way to go to create the above custom filter?
I have to create a Views custom filter handler that does everything, in this case I can generate html select directly in the handler and expose it by default without pass trough views interface to check "expose this.."? Or is best to FIRST create the above separate filters trough Views interface and then ALTER the form to combine all filters in a unique SELECT and then ALTER the query?
I've already take a look to Easy date selector for Views Exposed Date Filter but grouped filters are not a solution for me because I have to manage 2 dates, and not a single one (post date) as in that example.
I also look at How to customize exposed filter for date field? but I'm not sure if using templates like suggested is a good solution for me or there is a more elegant way to reach the goal.
Also found this module: https://www.drupal.org/project/views_between_dates_filter but doesn't provide the select I need.
Thank you very much for any help.