Needs work
Project:
Date
Version:
7.x-2.x-dev
Component:
Views Argument
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2012 at 17:48 UTC
Updated:
23 Jan 2017 at 18:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rmontero commentedI have attached a patch that would allow you to specify comparison operators other than 'equals' when using a date_field contextual filter (argument).
Comment #2
ayalon commentedThis is an absolute genius feature.
It's now possible to pass an argument and display all nodes greater/lower than the passed argument (date).
I use this feature on a customer site.
Attached you find an updated patch for the latest date module.
@Karen: Could you have a look a this? It's really nice and I attached a screenshot for better understanding.
Comment #3
ayalon commentedWrong status, it's reviewed. The credits go to the thread starter.
Comment #5
derekw commentedApplied the patch against -dev and flushed cache but the Operation option is not showing up on the form.
I'm trying to filter Content:Post Date, which requires adding Date:Date (Node) and then selecting the date field to use. So the contextual filter winds up looking like this: Date: Date (node) (Content: Post date)
Comment #6
kleinmp commentedI applied the patch and it worked properly for me, but I did it on version 7.x-2.5.
In order to see the operations select list, I had to use the 'Only this field' option under 'Dates to Compare', which makes sense to me
Comment #7
tim.plunkettThis will break all queries NOT using this new feature. The trick was to set the default value to NULL.
Comment #8
Jarode commentedNeed these operators for all numeric values. (ex: nid, tid, file size, uid...)
Thank you.
Comment #9
ultimateboy commentedThis is a fantastic feature addition which I needed for a current project. I applied the patch in #7 and had a few issues with it - my updated patch solves the issues I was having.
Upon applying the patch, I did not see the operations select item. I tracked this down to the
#accessattribute of the new form item. Seems like the rest of the form items simply set#accessto$access. This seems to be more consistent with the rest of the code and solved my issue of never being able to see the operations field.Secondly, I began getting a few notices/warnings, and several views simply stopped functioning as desired:
I solved this issue by removing the
return;from the operations conditional. Returning seems to be unnecessary here. Removing thisreturn;removed the notices/warnings and appears to make this patch act just as desired.Comment #10
andrew smith commentedI have applied the above patch - date-1417886-9.patch - but cannot see the operators. I understand 'Operations' should appear below 'Dates to compare' - but it's not there for me. Am I doing something wrong?
Comment #11
malberts commentedThe patch in #9 works for me.
However, it seems like this only works when you use "Date: Date (node)".
Adding the Date field directly does not give me the operators even when "Dates to Compare = Only this field".
Comment #12
David Stosik commentedHello,
I've been working on such idea on my side, and produced the patch attached. I don't know where we're at concerning this issue, but that'll be a way to up the topic.
This patch provides a field "operator" in arguments of type "Date: Date (Entity name)", which will be enabled only if "Dates to compare" = "Only this field".
Feel free to comment and tell me ways to improve my code, I feel like I forgot cases.
Thanks,
David
Comment #13
dealancer commentedReviewed patch #9:
It works good. However we don't need to make operation field required, but need to add custom validation. There is a reason: if Dates To Compare field is set to Start/End Date Range, then this field is hidden, but still required and validation error is thrown.
Comment #14
dealancer commentedRe rolled patch #9.
Comment #15
dealancer commentedComment #16
lunk rat commentedPatch in #14 works exactly as expected (I applied to 7.x-2.6 Date), is fantastically useful, and saved my butt on a project. Let me know how I can test/help to get this patch get committed, because this opens up a lot of great use-cases for filtering content by date.
Thanks ultimateboy and dealancer!
Comment #18
ultimateboy commentedRe-roll of #14.
Comment #19
vijaycs8518: 1417886-18.patch queued for re-testing.
Comment #21
vijaycs85Comment #22
podarokComment #23
timwoodRe-re-rolled of #18.
Comment #26
valentine94Re-roll of #23.
Comment #28
rwaery.11 commentedRe roll of #23