I kept getting illogical results when using the '-to Date' filter in a view. After some time, I realized that the behavior was exactly the same as if the '-to Date' filter was really a copy of the '-from Date' filter.

I obtained the same wrong behavior using the '-to Year' filter.

In the file date_views.inc, the declarations for the 'from' and 'to' filters have a different name but are otherwise identical. It seems like this bug would be easy to fix, but I'm not totally clear on the way the views filters work.

Thank you for this awesome module.

CommentFileSizeAuthor
#1 date_to_filter.patch3.25 KBronan

Comments

ronan’s picture

Status: Active » Needs review
StatusFileSize
new3.25 KB

Same problem exists in 4.7.x-1.x-dev (as of 2/28/07). This patch should fix it if applied to date_views.inc. It should apply to the HEAD version too, but I have not tested that.

Ronan

awood456’s picture

ronan, I've tested your patch in HEAD and it seems okay--EXCEPT for this part, which I don't think is quite right, so I didn't apply it locally:

@@ -144,13 +144,12 @@ function date_views_filter_handler($op, 
   $totype = $filterinfo['type'];
   $type = substr($totype, 0, 3) == 'to|' ? substr($totype, 3) : $totype;
   if ($totype == $type) {
-    $value = $filter['value'];
     $column = 'value';
   }
   else {
-    $value = $filter['value2'];
     $column = 'value2';
   }
+  $value = $filter['value'];

That part would always cause the 'now' test around line 169 to use the FROM value, regardless which is being requested (based on $type).

karens’s picture

I think this is partly right, but not yet exactly. I am investigating this.

karens’s picture

Status: Needs review » Fixed

I ended up fixing this differently. Committed to all branches.

Anonymous’s picture

Status: Fixed » Closed (fixed)
zilverdistel’s picture

Version: 7.x-1.x-dev » 4.7.x-1.x-dev
karens’s picture

Version: 4.7.x-1.x-dev » 7.x-1.x-dev
zilverdistel’s picture

I'm sorry Karen, but could you explain why this is still applicable to the 7.x version when the last relevant comment dates back to March 2007? May it be that some automated script is doing this?

karens’s picture

It doesn't matter, it is a closed issue. Some issues automatically keep bumping up to the latest version for reasons I don't even try to figure out.

zilverdistel’s picture

Ok. That's kinda annoying when you search the issue queue ...