Upcoming module fdate filter '>= now' still displays past events

kevancummins - March 9, 2009 - 13:59
Project:Calendar
Version:6.x-2.2
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I followed Sean Effel's great Tutorial to set up calendar on my Drupal 6 website http://www.drupaltherapy.com/node/76. I created a content type called 'Events' and added a field type 'date' and named it 'field_date'. This allows me to add a start date for the event.

I've come across something which doesn't seem to be working the way I think it should with the Upcoming block in Calendar on my site. I have replicted this in a fresh Drupal 6.10 install with following modules installed Calendar 6.x-2.0 |Date 6.x-2.0 | Views 6.x-2.3 | Content Construction Kit (CCK) 6.x-2.1

The default Upcoming block filters by the node updated date:
Date: Date Node: Updated date >= now

However, I want to filter by the Event date and have changed Filter to filter for the content type 'Events' and to filter date for:
Date: Date Content: - value >= now
Where the value comes from the 'date_field' from the events.

This seemed to be working fine with the block showing events that are coming up. But once the events go into the past they are still being displayed in the Upcoming block. The problem seems to be that 'now' is not working properly. If I change the setting to an absolute value for today e.g. Date: Date Content: - value >= 2009-03-09 00:00:00 then events in teh past are not shown.

Can anyone tell me if I am doing anything wrong with my settings or suggest what the problem might be?

Cheers

Kevan

#1

VM - March 9, 2009 - 14:12

Seems to be working correctly for me using calendar 6.x-2.x-dev date 6.x-2.x-dev and view 6.x-2.x-dev.
All modules are the most recent -dev releases.

My filter for upcoming is set at:

Date: Date Content: Date & Time (field_event_date_time) > now.
where Date & Time is the field label.

my granularity is set by day.

#2

chaps2 - March 10, 2009 - 14:48

I had the same problem and tracked it down to the Date 6.x-2.0 release. The latest development release of the Date module fixes it. More details here - http://drupal.org/node/386406.

#3

kevancummins - March 11, 2009 - 07:14

Thanks to you both for the fast response, solution and link to explanation of problem http://drupal.org/node/386406. - just upgraded date to 6.x-2.x-dev and it's fixed the problem - will try dev versions in future to see if fixes problem before posting

Cheers

Kevan

#4

VM - March 11, 2009 - 13:41
Status:active» fixed

#5

John Gentilin - March 17, 2009 - 09:15
Version:6.x-2.0» 6.x-2.x-dev
Status:fixed» active

I am having this same problem, I was previously using 6.x-2.0-rc6, then upgraded to calendar-6.x-2.0 after reading this article I upgraded to the dev version and I am still getting the NOW problem... I tried to delete my filters, and add again.. it did not help, I also tried to expose the date which did not work either... I am also seeing a problem where I lost the field names when I go to select the date field, this happened right after the upgrade. The one thing that is different with this content type is that there are 2 date fields, 2 datetime's, 1 date... only the last date type field in the retained its name..
see
Date field(s):
Content: - value
Content: - value
Content: - value2
Content: - value2
Content: EMail Date - (field_emaildate)

Is there a way to downgrade to rc6 ?
My DB is fairly small, I could zip up and send to someone if they need more debug info..

Here is my exported view...
$view = new view;
$view->name = 'UpcomingEvents';
$view->description = 'This view will hold the block views for the front page';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'title' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'field_eventdate_value' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'none',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_eventdate_value',
'table' => 'node_data_field_eventdate',
'field' => 'field_eventdate_value',
'relationship' => 'none',
),
));
$handler->override_option('sorts', array(
'field_eventdate_value' => array(
'order' => 'ASC',
'delta' => -1,
'id' => 'field_eventdate_value',
'table' => 'node_data_field_eventdate',
'field' => 'field_eventdate_value',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'date_filter' => array(
'operator' => '>=',
'value' => array(
'value' => NULL,
'min' => NULL,
'max' => NULL,
'default_date' => 'now',
'default_to_date' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'date_fields' => array(
'node_data_field_eventdate.field_eventdate_value' => 'node_data_field_eventdate.field_eventdate_value',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => 'now',
'default_to_date' => '',
'year_range' => '-3:+3',
'id' => 'date_filter',
'table' => 'node',
'field' => 'date_filter',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('title', 'Other Area Events');
$handler->override_option('header_format', '1');
$handler->override_option('header_empty', 0);
$handler->override_option('items_per_page', 3);
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
'grouping' => '',
'columns' => '4',
'alignment' => 'horizontal',
));
$handler = $view->new_display('block', 'Dinners', 'block_1');
$handler->override_option('filters', array(
'field_eventtype_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'Member Dinner' => 'Member Dinner',
'Family Dinner' => 'Family Dinner',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_eventtype_value_many_to_one',
'table' => 'node_data_field_eventtype',
'field' => 'field_eventtype_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 1,
),
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'date_filter' => array(
'operator' => '>=',
'value' => array(
'min' => NULL,
'max' => NULL,
'value' => NULL,
'default_date' => 'now',
'default_to_date' => '',
),
'group' => '0',
'exposed' => TRUE,
'expose' => array(
'use_operator' => FALSE,
'operator' => 'date_filter_op',
'identifier' => 'date_filter',
'label' => 'Date: Date',
'remember' => FALSE,
'single' => TRUE,
'optional' => TRUE,
),
'date_fields' => array(
'node_data_field_eventdate.field_eventdate_value' => 'node_data_field_eventdate.field_eventdate_value',
),
'date_method' => 'OR',
'granularity' => 'day',
'form_type' => 'date_select',
'default_date' => 'now',
'default_to_date' => '',
'year_range' => '-3:+3',
'id' => 'date_filter',
'table' => 'node',
'field' => 'date_filter',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('title', 'Dinners');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array());
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'OtherEvents', 'block_2');
$handler->override_option('filters', array(
'field_eventtype_value_many_to_one' => array(
'operator' => 'not',
'value' => array(
'Member Dinner' => 'Member Dinner',
'Family Dinner' => 'Family Dinner',
'Club Event' => 'Club Event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_eventtype_value_many_to_one',
'table' => 'node_data_field_eventtype',
'field' => 'field_eventtype_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 1,
),
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('block', 'ClubEvents', 'block_3');
$handler->override_option('filters', array(
'field_eventtype_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'Club Event' => 'Club Event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_eventtype_value_many_to_one',
'table' => 'node_data_field_eventtype',
'field' => 'field_eventtype_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 1,
),
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('title', 'Alpicella Club Events');
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array());
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'DinnerList', 'page_1');
$handler->override_option('fields', array(
'field_eventdate_value' => array(
'label' => 'Dinner Date',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'custom',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_eventdate_value',
'table' => 'node_data_field_eventdate',
'field' => 'field_eventdate_value',
'relationship' => 'none',
'override' => array(
'button' => 'Use default',
),
),
'field_notifydate_value' => array(
'label' => 'Notify By',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'custom',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_notifydate_value',
'table' => 'node_data_field_notifydate',
'field' => 'field_notifydate_value',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
'body' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
),
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'field_eventtype_value_many_to_one' => array(
'operator' => 'or',
'value' => array(
'Member Dinner' => 'Member Dinner',
'Family Dinner' => 'Family Dinner',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'field_eventtype_value_many_to_one',
'table' => 'node_data_field_eventtype',
'field' => 'field_eventtype_value_many_to_one',
'override' => array(
'button' => 'Use default',
),
'relationship' => 'none',
'reduce_duplicates' => 1,
),
'type' => array(
'operator' => 'in',
'value' => array(
'event' => 'event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('title', 'Upcoming Dinners at the Alpicella Club');
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array());
$handler->override_option('path', 'DinnerList');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
));

#6

John Gentilin - March 17, 2009 - 09:59
Status:active» fixed

Found it, needed to upgrade both Calendar + Date to _dev versions then had to clear the cache..
That combo fixed it.. including the fields with the missing names.

#7

System Message - March 31, 2009 - 10:00
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#8

mafi-a - March 31, 2009 - 16:47
Version:6.x-2.x-dev» 6.x-2.1
Category:support request» bug report
Status:closed» active

Was this issue fixed in the latest release version?

It worked for me with the old dev-version but in 2.1 the date filter again shows old events.

#9

xqbzzr - March 31, 2009 - 21:11

Yeah, me too!
Using the 2.1 Version and having the same problem.

#10

didymo - April 1, 2009 - 10:03

After taking a long time I think I have isolated this bug. I hope this helps somebody.

After upgrade of a live site the setup is:

Calendar 6.x-2.1
Date 6.x-2.1
Date API 6.x-2.1
Views 6.x-2.3

After noticing that the filter greater than or equal to now was not being recorded in my Upcoming Events view, I went to the original calendar set of views and looked at the Upcoming sql query in the untouched default. It is:

SELECT node.nid AS nid,
node.title AS node_title,
node.changed AS node_changed
FROM node node
WHERE node.status <> 0
ORDER BY node_changed ASC

However if I look at the site before I upgraded I find that the upcoming view query is:

SELECT node.nid AS nid,
node.changed AS node_changed,
node.title AS node_title
FROM node node
WHERE (node.status <> 0)
AND (DATE_FORMAT(ADDTIME(FROM_UNIXTIME(node.changed), SEC_TO_TIME(39600)), '%Y-%m-%%d') >= '2009-04-01')
ORDER BY node_changed ASC

So the base upcoming view has been altered. No idea why. When I attempt to create my own upcoming view with the greater or equal filter it is not being recorded.

I have no idea why this is happening.

I hope this helps.

Regards,

didymo

#11

rjoy - April 1, 2009 - 16:36

It worked for me with the old dev-version but in 2.1 the date filter again shows old events.

--same here... subscribing

#12

KarenS - April 1, 2009 - 16:54
Status:active» fixed

Please read the project page where I put up troubleshooting tips and how to tell which is the 'latest' version. All these posts that say it is fixed in the 'old' dev version and broken in the 'later' 2.1 have things reversed and are totally confusing this issue.

It is fixed in the latest version, which is -dev.

#13

mafi-a - April 1, 2009 - 20:22

When will it be fixed in an official version?

#14

rjoy - April 1, 2009 - 21:15

Karen,
Sorry for the misunderstanding. I assumed the new release included this since its date was more recent than the -dev I was using. At least I only installed on my test server! Thanks for all your work on this and your patience with the rest of us.

~Joy

#15

System Message - April 15, 2009 - 21:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#16

techtweaker - April 23, 2009 - 17:19

I had this same problem (where a relative "now" date wouldn't be included in the query, but a static defined one would) on Drupal 6.10 - Calendar (6.x-2.1), Date (6.x-2.1). A relative "now" defined data would in turn display ALL events in the Upcoming Events block past, present, and future.

I followed TROUBLESHOOTING steps outlined on both of the Calendar and Date project pages, updating to 6.x-2.x dev snaps (Calendar 3/25, Date 4/21 ATOW), clearing drupal/view caches, and re-checking all date fields.

Now my "Upcoming Events" view display/block works perfectly, displaying only future events. Mine is filtered on (Content: Date (field_date) - From date >= now). Of course it this would imply that it's now being included in the query.

Confirmed BUG fix on my side. Here's looking forward to inclusion in the next major 2.2 release(s).

========

Another great thing is fixed in 2.x dev snaps. In 2.1 version, when you go to add a "Date" type field to a filter it listed three Date check boxes, but no differentiation/labeling between them.

Now it lists the following:

Date: Date (comments)
Filter any Views comments date field.
Date: Date (node)
Filter any Views node date field.
Date: Date (users)
Filter any Views users date field.

I believe that was PART of my problem in the first place, I had just selected the first one listed. After the upgrade to calendar/date dev packages I found my "Upcoming Event" view was filtering on comments date field instead of the desired "node" date type. Thanks for fixing/clarifying these date fields :-).

#17

macrocosm - June 1, 2009 - 08:07
Status:closed» active

Im pretty sure I have the latest dev's and have flushed all caches & done updates .. for some reason its still showing old dates .... which is strange cause it was working before!#$##%@!

Date: Date (node) Content: Date (field_date) - From date >= now -1 day

The only thing different is that I updated to the new Views-6.x-2.5 recently. Do we still need to use the views dev?

EDIT: I just checked and updated to the latest views dev didnt change anything.

#18

VM - June 1, 2009 - 16:10

pretty sure you have the latest -dev, isn't 100% sure. I'd update to the latest -dev of date.module now, so that you can be 100% sure as in the latest -dev I've not seen this issue at all. I also run the latest -dev of views.

#19

macrocosm - June 2, 2009 - 06:35

By pretty sure I mean .. certain ;)

Date 6.x-2.x-dev (2009-May-03)
Calendar 6.x-2.x-dev (2009-May-11)
Views 6.x-2.x-dev (2009-May-27)

I have disabled deleted them and re-downloaded them a couple of times just to be sure. Cleared all caches .. gone to the content_type edit page and saved as well as re-saved the filter and the view, several times. The date field setup seems to be fine ... it worked perfect before as soon as I installed the dev versions .. I had no trouble with it until recently. Not sure what the problem could be yet. Ive attached my views export. Looks fine to me especially since it was working and I have not changed it.

The only thing ive not tried yet is uninstalling because I didnt want to have to set-up everything again. Im going to try it on another instance right now to see if that helps.

AttachmentSize
date_views_export.txt 14.63 KB

#20

macrocosm - June 2, 2009 - 06:59

Just wanted to add that on my live site where this problem is not present I am using
Date 6.x-2.x-dev (2009-May-04)
Calendar 6.x-2.1
Views 6.x-2.5

All field settings and whatnot are identical. I am going to try pulling that old code and not using the dev of calendar or views to see if that fixes it .. the only other major diff is that I am running Drupal 6.11 on my live site and Drupal 6.12 on my testing server.

#21

macrocosm - June 2, 2009 - 07:57

Ok it must be something corrupted in the db ... because when I completely uninstall the date & calendar modules and reinstall, the upcoming block performs as expected. I wonder if there is a way for me to fix this without having to completely trash my existing setup? Im going to loose all my settings, dates, etc and have to start from scratch? I guess its nice to have the option though... I was beginning to go nuts, not being able to find a fix!

#22

KarenS - June 2, 2009 - 14:10
Status:active» postponed (maintainer needs more info)

Views caches things in all kinds of places, including the SESSION. I suspect you had bad values stuck somewhere. When you say that you 'cleared all the caches' did you use the Views Tools tab to clear the Views cache there and check the option to 'Disable views data caching' until things are working right. Then edit and re-save your view again and see if that is enough to get things working.

#23

macrocosm - June 3, 2009 - 02:07
Status:postponed (maintainer needs more info)» fixed

Yes I did do that to clear the views cache ... also I use the administration menu which has buttons to clear caches as well.

I just went ahead and used the wizard again on top of my already existing date content type. and moved over the old data/dates etc to my new date field. Everything is working perfectly now! It must have been something awry in my db. I'm really not sure what could have caused it, but at any rate im glad it's fixed!!

Thanks for the help!
Cheers!

#24

System Message - June 17, 2009 - 02:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

#25

kscott22 - September 18, 2009 - 14:50
Version:6.x-2.1» 6.x-2.2

I'm not sure why, but I'm having the same problem with the date filter ">= now" showing past events.

I'm using
Calendar 6.x-2.2
views 6.x-2.6
date 6.x-2.3

Are there other versions/patches I need? Thanks!

#26

VM - September 18, 2009 - 17:32

update to date 2.4 and retest.

#27

dankoB - September 20, 2009 - 14:51

I had a similar problem with past events showing up in my Upcoming Events block. I found it was the granularity setting in the Argument list. It was set on "month". When I switched to "day" my problem was solved. However, the side effect of this is that if you have a little calendar block, that is also switched to the current day instead of the current month. So I switched granularity back to "month" in the default, then went back to Upcoming:Configure Argument Date: Date (node), clicked the Override button and then switched to granularity "day." Now it's fine for both.

#28

kscott22 - September 24, 2009 - 00:07

dankoB, you are a genius.

Thank you, thank you, thank you!

#29

attilahooper - November 6, 2009 - 14:40

yep, dankoB hit the nail on the head. I was sorely confused, trying to wrap my head around this bug, since I am just beginning to understand this wonderful group of modules.
Thx Karen.

 
 

Drupal is a registered trademark of Dries Buytaert.