Query method not triggered in custom filter handler? I'm using Views 3. 

I needed to create a custom Views filter that handle dates range. So I looked at example and tried to mimic the behavior and I got some trouble.

It seems that when I extend my own class from views_handler_filter, the query method is never invoked, BUT if I extend my class from let's say views_handler_filter_string it works.

I must forget something but I'm stuck here.

Here is my code, if someone can take a look and advise me about what happened, I would be very grateful.

Here is my .views.inc file :  

&lt;?php
  class v3d_date_custom_filter extends views_handler_filter {
    var $always_multiple = TRUE;

    function value_form(&amp;$form, &amp;$form_state) {
      //parent::value_form($form, $form_state);
      $form['value']['v3d_date']['period'] = array(
        '#type' =&gt; 'select',
        '#title' =&gt; 'Period',
        '#options' =&gt; array(
          '7_days' =&gt; 'Last 7 days',
          'yesterday' =&gt; 'Yesterday',
          'today' =&gt; 'Today',
          'custom' =&gt; 'Custom dates'),
        '#default_value' =&gt; 'custom',
        '#attributes' =&gt; array("onclick" =&gt; "period_click(this);"),
      );

      $form['value']['v3d_date']['start_date'] = array(
        '#type' =&gt; 'date_popup',
        '#date_format' =&gt; 'Y-m-d',
        '#title' =&gt; 'Start date',
        '#size' =&gt; 30);

      $form['value']['v3d_date']['end_date'] = array(
        '#type' =&gt; 'date_popup',
        '#title' =&gt; 'End date',
        '#date_format' =&gt; 'Y-m-d',
        '#size' =&gt; 30);
      }

   function exposed_validate(&amp;$form, &amp;$form_state) {

     if(is_null($form_state['values']['start_date']) &amp;&amp;
        is_null($form_state['values']['start_date'])) {
        return TRUE;
     }


    /*
     * If we get array for start_date or end_date
     * errors occured, but the date module will handle it.
     */
     if(!is_string($form_state['values']['start_date']) ||
        !is_string($form_state['values']['end_date'])) {
       return TRUE;
     }


     /* Get day, month and year from start_date string */
     if(!preg_match('/(\d+)-(\d+)-(\d+)/',
        $form_state['values']['start_date'],
        $start_date
        )) {
       return TRUE; }

     /* Get day, month and year from end_date string */
     if(!preg_match('/(\d+)-(\d+)-(\d+)/',
        $form_state['values']['end_date'],
        $end_date
     )) {
       return TRUE; }

     /* Create timestamps and compare */
     $start_date = mktime(0,0,0,$start_date[1],$start_date[2],$start_date[3]);
     $end_date = mktime(0,0,0,$end_date[1],$end_date[2],$end_date[3]);

     if($start_date &gt;= $end_date) {
       form_set_error('start_date','Start date must be anterior to end date.');
     }
   }

   function query() {
     die('fdsfds');
     $this-&gt;ensure_my_table();
     $field = "$this-&gt;table_alias.$this-&gt;real_field";
     dsm($this);
   }

 }
?&gt;


And my .module file

&lt;?php
  function custom_filters_views_api() {
    return array(
      'api'=&gt;3,
      'path' =&gt; drupal_get_path('module','custom_filters') . '/views',
    );
  }
?&gt;


And  part of my views_data that use my custom filter :

&lt;?php                                                                                      

function voice_views_data() {

  $data['v_tp_voice']['date_utc_agent'] = array(
    'title' =&gt; t('date_utc_agent'),
    'help' =&gt; 'date_utc_agent',
    'field' =&gt; array('handler' =&gt; 'views_handler_field'),
    'filter' =&gt; array('handler' =&gt; 'v3d_date_custom_filter'),
    'sort' =&gt; array('handler' =&gt; 'views_handler_sort')
  );

  return $data;
}
As suggested by todinov, you can use Drupal contrib modules Date along with its sub module Date Views which will most probably handle any kind of filter in Views. If it doesn't help, you can achieve it through code by implementing hook_views_query_alter.