I'm testing D6.2 for a new site and have Views 6.x-2.0-beta3, Date-6.x-1.x-dev, and CCK 6.x-1.0-alpha installed. I have a view called "eventlist" which I want to display "event" nodes with an "eventstart" (CCK date field) time greater than or equal to "now," but have not been able to coax it to do so. I realize that this is a lot of dev code to throw together, which makes pinpointing the source of the problem harder.

Without the date filter, or with a blank one, I get events listed as expected. Under Filters, I am only given options to filter on field_eventstart for Year, Month, and Day, even though the field is set to provide minute-level granularity. So first I tried setting greater than or equal to now-now-now for the y-m-d, which returns zero nodes. I then tried setting an explicit date using the drop-down menus (e.g. 2008-May-01), but was not able to update; I get the red error box with the cryptic message "is invalid. is invalid. is invalid."

The dates are indeed stored correctly in our database, in the new Date module format (e.g. 2008-05-25 17:30:45 instead of the Unix timestamp). Is the problem as simple as Views 2 being built with the older Date module in mind?

 $view = new view;
$view->name = 'eventlist';
$view->description = 'List of upcoming events';
$view->tag = 'eventlist';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = '0';
$view->api_version = 2;
$view->disabled = FALSE; // Edit this to true to make a default view disabled initially
$view->display = array();
  $display = new views_display;
  $display->id = 'default';
  $display->display_title = 'Defaults';
  $display->display_plugin = 'default';
  $display->position = '1';
  $display->display_options = array(
  'style_plugin' => 'list',
  'style_options' => array(
    'type' => 'ul',
  ),
  'row_plugin' => 'fields',
  'row_options' => array(),
  'relationships' => array(),
  'fields' => array(
    'field_eventstart_value' => array(
      'id' => 'field_eventstart_value',
      'table' => 'node_data_field_eventstart',
      'field' => 'field_eventstart_value',
      'label' => '',
      'format' => 'short',
      'multiple' => array(
        'group' => TRUE,
        'multiple_number' => '',
        'multiple_from' => '',
        'multiple_reversed' => FALSE,
      ),
      'relationship' => 'none',
      'link_to_node' => 0,
    ),
    'title' => array(
      'id' => 'title',
      'table' => 'node',
      'field' => 'title',
      'label' => '',
      'relationship' => 'none',
      'link_to_node' => 1,
    ),
  ),
  'sorts' => array(
    'field_eventstart_value' => array(
      'id' => 'field_eventstart_value',
      'table' => 'node_data_field_eventstart',
      'field' => 'field_eventstart_value',
      'order' => 'ASC',
      'relationship' => 'none',
    ),
  ),
  'arguments' => array(
    'name' => array(
      'id' => 'name',
      'table' => 'term_data',
      'field' => 'name',
      'default_action' => 'ignore',
      'style_plugin' => 'default_summary',
      'style_options' => array(
        'count' => TRUE,
        'override' => FALSE,
        'items_per_page' => 25,
      ),
      'wildcard' => 'all',
      'wildcard_substitution' => 'All',
      'title' => '%1 eventlist',
      'default_argument_type' => 'fixed',
      'default_argument' => '',
      'validate_type' => 'none',
      'validate_fail' => 'not found',
      'glossary' => 0,
      'limit' => '0',
      'case' => 'none',
      'path_case' => 'none',
      'transform_dash' => 1,
      'relationship' => 'none',
      'default_argument_fixed' => '',
      'default_argument_php' => '',
      'validate_argument_node_type' => array(
        'event' => 0,
        'page' => 0,
        'story' => 0,
      ),
      'validate_argument_php' => '',
      'add_table' => 0,
      'require_value' => 0,
    ),
  ),
  'filters' => array(
    'type' => array(
      'id' => 'type',
      'table' => 'node',
      'field' => 'type',
      'operator' => 'in',
      'value' => array(
        'event' => 'event',
      ),
      'group' => 0,
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'relationship' => 'none',
      'expose_button' => array(
        'button' => 'Expose',
      ),
    ),
    'tid' => array(
      'id' => 'tid',
      'table' => 'term_node',
      'field' => 'tid',
      'operator' => 'or',
      'value' => array(),
      'group' => 0,
      'exposed' => TRUE,
      'expose' => array(
        'operator' => 'tid_oper',
        'identifier' => 'tid',
        'label' => 'Category',
        'optional' => 1,
        'single' => 1,
        'remember' => 0,
        'reduce' => 0,
      ),
      'type' => 'select',
      'vid' => '1',
      'hierarchy' => 1,
      'relationship' => 'none',
      'expose_button' => array(
        'button' => 'Hide',
      ),
      'reduce_duplicates' => 1,
    ),
    'field_eventstart_value' => array(
      'id' => 'field_eventstart_value',
      'table' => 'node_data_field_eventstart',
      'field' => 'field_eventstart_value',
      'operator' => '>=',
      'value' => array(
        'valueyear' => 'now',
        'valuemonth' => 'now',
        'valueday' => 'now',
        'minyear' => '',
        'minmonth' => '',
        'minday' => '',
        'maxyear' => '',
        'maxmonth' => '',
        'maxday' => '',
      ),
      'group' => 0,
      'exposed' => FALSE,
      'expose' => array(
        'operator' => FALSE,
        'label' => '',
      ),
      'granularity' => 'day',
      'adjustment_field' => 0,
      'relationship' => 'none',
      'expose_button' => array(
        'button' => 'Expose',
      ),
    ),
  ),
  'items_per_page' => 10,
  'distinct' => 1,
  'use_pager' => '1',
  'pager_element' => 0,
  'title' => 'Upcoming eventlist',
  'use_ajax' => '1',
);
$view->display['default'] = $display;
  $display = new views_display;
  $display->id = 'page';
  $display->display_title = 'Page';
  $display->display_plugin = 'page';
  $display->position = '2';
  $display->display_options = array(
  'defaults' => array(
    'access' => TRUE,
    'title' => TRUE,
    'header' => TRUE,
    'header_format' => TRUE,
    'header_empty' => TRUE,
    'footer' => TRUE,
    'footer_format' => TRUE,
    'footer_empty' => TRUE,
    'empty' => TRUE,
    'empty_format' => TRUE,
    'use_ajax' => TRUE,
    'items_per_page' => TRUE,
    'offset' => TRUE,
    'use_pager' => TRUE,
    'pager_element' => TRUE,
    'use_more' => TRUE,
    'distinct' => TRUE,
    'link_display' => TRUE,
    'style_plugin' => TRUE,
    'style_options' => TRUE,
    'row_plugin' => TRUE,
    'row_options' => TRUE,
    'relationships' => TRUE,
    'fields' => TRUE,
    'sorts' => TRUE,
    'arguments' => TRUE,
    'filters' => TRUE,
  ),
  'relationships' => array(),
  'fields' => array(),
  'sorts' => array(),
  'arguments' => array(),
  'filters' => array(),
  'path' => 'eventlist',
  'menu' => array(
    'type' => 'tab',
    'title' => 'eventlist',
    'weight' => '0',
  ),
);
$view->display['page'] = $display;
  $display = new views_display;
  $display->id = 'block';
  $display->display_title = 'Block';
  $display->display_plugin = 'block';
  $display->position = '3';
  $display->display_options = array(
  'defaults' => array(
    'access' => TRUE,
    'title' => TRUE,
    'header' => TRUE,
    'header_format' => TRUE,
    'header_empty' => TRUE,
    'footer' => TRUE,
    'footer_format' => TRUE,
    'footer_empty' => TRUE,
    'empty' => TRUE,
    'empty_format' => TRUE,
    'use_ajax' => TRUE,
    'items_per_page' => TRUE,
    'offset' => TRUE,
    'use_pager' => TRUE,
    'pager_element' => TRUE,
    'use_more' => TRUE,
    'distinct' => TRUE,
    'link_display' => TRUE,
    'style_plugin' => TRUE,
    'style_options' => TRUE,
    'row_plugin' => TRUE,
    'row_options' => TRUE,
    'relationships' => TRUE,
    'fields' => TRUE,
    'sorts' => TRUE,
    'arguments' => TRUE,
    'filters' => TRUE,
  ),
  'relationships' => array(),
  'fields' => array(),
  'sorts' => array(),
  'arguments' => array(),
  'filters' => array(),
);
$view->display['block'] = $display;
 

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Date
Version: 6.x-2.0-beta3 » 6.x-1.x-dev
Component: User interface » Date CCK Field

Questions that are exclusively about fields from modules go to the module first. =)

choster’s picture

Title: Cannot filter by date; date granularity, compatibility questions » Cannot add date filter to views; 'views_date_handler' not found
Version: 6.x-1.x-dev » 6.x-2.x-dev
Category: support » bug

I tried again with a completely fresh install of D6.2 (PHP 5.2.1, MYSQL 4.1.21), with the 27 May 6.2-dev of date, views 6.2-dev, and cck 6.1-dev. Now, I cannot add a date filter at all. The PHP error is

Fatal error: Class 'views_date_handler' not found in /mypath/public_html/sites/all/modules/date/date_api.views.inc on line 522

karens’s picture

I moved all the arguments and filters into the Date API and re-tested all the arguments but not the filters, so I need to do some investigation. The filters have a separate option setting where you can choose the granularity to set it to include hours and minutes -- that's on a separate screen. I don't assume that you always want that level of granularity even if your date field has it, since I often want to filter my events by month or day.

I'm still playing around with all the new Views 2 options for the filters trying to find a good balance between making them flexible but not getting them too complicated, so the final solution may not be the same as the current code.

Anonymous’s picture

Same error here on my site. Is there a granularity level that you have been using that does work in Filter? I have been trying to use down to the day, not time. What can I do to help?

raspberryman’s picture

Reproduced via the UI:

I am unable to add a 'date' filter. When I click on "Add" for a new date filter, a JS window says "An error occurred" and Firebug returns:

Fatal error: Class 'views_date_handler' not found in \sites\all\modules\date\date_api.views.inc on line 522

sifaan’s picture

I also have this problem - I am trying to display nodes that have not yet "expired":

First I have a problem "An error occured" when I try to add a date type as a filter. But despite the error, it does add the date in the filter list (need some skipping back and forth to get it to display)

Thereafter, I tried to set the filter as expiry date >= now-now-now and nothing passes through the filter.
I tried to test it with a specific date (e.g. 2008-01-01) and I get an "is invalid" error for every value I entered (only way not to get errors is "now" and "blank")

I tried the interesting option of exposing the filter, when I try "is greater than" 2008-01-01 (in the exposed form it allows me to enter a date) then no nodes are displayed. I tried "is less than" 2008-01-01 and all nodes are displayed (even though actually all test nodes have expiry dates in June 2008)

I am using a fresh install of Drupal 6.2 with CCK 6.x-2.0-beta, Views 6.x-2.0-beta3, Date 6.x-2.0-beta

choster’s picture

To update, with today's latest views 6.2-dev and date 6.2-dev, the error has changed to

Fatal error: Call to a member function date_parts() on a non-object in /mypath/public_html/sites/all/modules/date/date_api.views.inc on line 519

karens’s picture

Status: Active » Fixed

I just released a new 6.2-beta2 version for Date, so update to the latest code for Date and also get the latest -dev version of the Views module, which has some date-related changes that are needed for the Date views handling. If you use the Calendar module, get the new 6.2-beta2 version of that as well.

If you still have problems after that, open a new issue marked with the beta2 version so I know it's still a problem there.

rambal’s picture

I had download the beta 2.
I'm seeing this error earlier.

Fatal error: Class 'views_handler_argument_date' not found in C:\wamp\www\tracky\sites\all\modules\date\date_api.views.inc on line 96

After Installing the views, it works fine

sifaan’s picture

the latest views -dev module takes a bit of scrolling in the all releases page ;)
http://drupal.org/node/95897

rdonahue’s picture

Version: 6.x-2.x-dev » 6.x-2.0-beta2

I'm still experiencing this problem with not being able to apply a date filter.. using beta2 of date and newest calendar dev version.

Specific error is

Fatal error: Call to a member function date_parts() on a non-object in /Applications/MAMP/htdocs/Main/modules/date/date_api.views.inc on line 519

rdonahue’s picture

Status: Fixed » Active

erm, probably should be active too.

karens’s picture

Status: Active » Closed (duplicate)

There are two different issues here, and both are duplicates.

I don't have time to keep looking up the url of the duplicate issues, but they're both already reported. The problem with date filters is still outstanding. The error about a missing date argument handler is because you need a more recent version of Views.