How to create a Views custom exposed filter with predefined range of date values (today, next 15 days, next month) 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 &lt;= NOW &amp;&amp; end_date >= NOW)

In the next 15 days
(start_date &lt;= NOW+15day &amp;&amp; end_date >= NOW)

Next month
(start_date &lt;= $next_month_last_day &amp;&amp; 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.
I've written a custom module exactly for this purpose but haven't released it as it ended up being a little less abstracted than I'd like. 

The way you do it is by writing a Views filter handler (which is surprisingly easy). Without giving the whole game away and leaving a little homework for you: please read on. Let me know how you go.

You'll need a line in your .info file.

files[] = inc/views_relative_date_filters.inc


Register it with the Views API in the .module file.

/**
 * Implements hook_veiws_api().
 */
function views_relative_date_filters_views_api() {
  return array(
    'api' =&gt; 2,
    'path' =&gt; drupal_get_path('module', 'views_relative_date_filters') . '/inc'
  );
}


Register the Views handlers inc/views_relative_date_filters.views.inc

function views_relative_date_filters_views_handlers() {
  return array(
  // ...
  );
}

function views_relative_date_filters_views_data() {
  $data = array();
  // ...
  return $data;
}


And finally write the filter itself in inc/views_relative_date_filters.inc

class views_relative_date_filters extends views_handler_filter {
  // You'll need an options form (just use the parent)
  function options_form(&amp;$form, &amp;$form_state) {
    parent::options_form($form, $form_state);
  }

  // You can use a views_form or an
  function exposed_form(&amp;$form, &amp;$form_state) {
    // Return a Form API select element
    // ... all, this-day, this-fornight, this-month
  }

  // The query to get your results based on your time period
  function query() {
    $this-&gt;ensure_my_table();

    // Get the value of the submitted filter
    if (isset($this-&gt;value[0])) {
      $value = $this-&gt;value[0];
    } else {
      $value = 'all';
    }

    // A switch on the $value
    switch( $value ) {
      case 'all';
        return;
      case 'this-month':
        // Modify your query with where conditions, groups, joins, whatever
        // ...
        break;
      case 'this-fortnight':
        // Modify your query with where conditions, groups, joins, whatever
        // ...
        break;
      case 'this-day':
        // ...
        break;
      case default;
        break;
    }
  }
}