I'm using exposed filter of created date with "Is between" and optional. When the input fields are empty the list is too, although it's should be unfiltered list. I guess It's causing from the WHERE (node.created >= 0) AND (node.created <= 0) sentence. as far as I understand, this sentence should not be there at all while the fields are empty. attach a patch suggest to fix it.

Comments

dawehner’s picture

Status: Active » Needs review

update

konforti’s picture

StatusFileSize
new1.43 KB

There was a problem handling dates from 1/1/1970 and earlier.
This patch handle it in a better way.

konforti’s picture

StatusFileSize
new1.69 KB

When entering just one value in a two values exposed date filter, it returns no result (before the above patch or all result with the patch). some times you want to filter from some date on or from ever to some date. in this one added this fix which depending on the former code.

YK85’s picture

esmerel’s picture

#843878: Optional "in between" filters not really optional may be related as well. I think they're expressing the same issue, but maybe in different places.

Bevan’s picture

This ticket is about date filters for node dates that are supported in views, while #681450: Views optional exposed date filter does not work without value is about CCK Date fields, supported by date module. Though the bugs are very similar, the causes and fixes are entirely unrelated.

merlinofchaos’s picture

Status: Needs review » Needs work

In Views 3, we need to actually make sure that both of these statements are part of the same add_where() or we run the risk of the between becoming an OR. I realize that's a problem with the existing code but we may as well fix it as part of this patch.

Also, I don't understand why the intval() was split out. There seems to be no benefit to that change.

konforti’s picture

StatusFileSize
new2.21 KB

Fixed to implement one add_where() for both statements.
The intval() split out, was made for getting the difference between, the timestamp 0 to FALSE.
The intval() returns 0 in both cases. The IF statements fixed, to make it actually work.

merlinofchaos’s picture

Status: Needs work » Needs review

Remember to mark patch updates as 'needs review' or they don't get seen.

nicholas.alipaz’s picture

subscribing since I was affected in a duplicate issue.

merlinofchaos’s picture

Status: Needs review » Needs work

Hm. There is a conflict and the patch currently does not apply.

There's also some minor style issues that I was going to clean it manually, but since it doesn't apply I'll kick it back. This has some spacing stuff that I would like cleaned:

-
+    

It's hard to see since the spaces are invisible, but that's changing a blank line to a line with spaces equal to the indent level of the previous line. Most modern editors can auto-trim trailing spaces for you.

+    }
   }
-
   function op_simple($field) {

Removing the blank link prior to a function is against my coding style.

konforti’s picture

Status: Needs work » Needs review
StatusFileSize
new2.07 KB

Oops, sorry.
Re-created the patch with the fixes.
Tested for no conflict on applying.
Thanks.

PixelClever’s picture

mustanggb’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)