I have a CCK Content type that contains a start date field and end date field. I am trying to create a view that allows users to pick a from and to date and show all nodes whose start is after the "from" date before the "to" date. I added two filters and exposed them, however, no filtering is being done. The problem seems to occur in date_views.inc: date_views_timestamp_filter_handler The value of $type is 'DATE' which falls to the default block and returns without adding a where clause. If I comment out lines 156 and 159 the where clause gets added and the filter works correctly. I'm not really sure what the function SHOULD do though as the comments are extremely sparse. I will provide any help necessary to get a patch made.
Comments
Comment #1
imrook commentedOkay, I looked at the code a little closer and I think I have found a logic error.
if ($field_type == 'int' && (empty($value) || !($value == 'now' || date_is_valid($value, DATE_UNIX)))) { return; } elseif (empty($value) || !($value == 'now' || date_is_valid($value, DATE_ISO))) { return; } break;Examine the case where $value is a valid ISO date:
In the first if statement $value == 'now' is FALSE and date_is_valid($value, DATE_UNIX) is FALSE
The value is then complimented to become true and the function returns.
I am using the following code on my site and would like to have it reviewed before making a patch.
if (empty($value)) { return; } elseif (!($value == 'now' || date_is_valid($value, DATE_ISO) || date_is_valid($value, DATE_UNIX))){ return; } break;Comment #2
imrook commentedSorry, used the wrong tags:
Replace
With
Comment #3
mlncn commentedThis fix works. It didn't before. My client will be using it and seeing if any new problems pop up, but if it's still good for linuxbox and imrook, we should get this fix in. I can also roll a patch against head.
Comment #4
jscheel commentedI've been tracking down this bug. The problem occurs when date_sql() in date.inc writes out the interval offset. Verify by removing the interval in a sql statement generated by date_sql().
Comment #5
aren cambre commentedhttp://drupal.org/node/190289 was marked as a duplicate of this one.
Comment #6
avior commentedHi
Is this patch included in the current release ?
what is the status of this ?
Comment #7
dugh commentedSee http://drupal.org/node/277420
I still see the issue although it has been marked as fixed with the latest dev version.
Comment #8
Remon commentedme too still facing the same problem
Comment #9
aren cambre commentedMarking as duplicate since the issue referenced in #7 is about the same problem and is getting a lot of love right now.