Following are the steps to reproduce the issue:
- Create user date field e.g. field_user_date and add some sample users
- Set the value of 'field_user_date' for some users
- Create a user view with 'field_user_date' filter as exposed filter and also expose it's operator
- visit the view page and directly select Is empty(null) and click Apply
- You will see that results are incorrect, it is showing the users for which 'field_user_date' is not NULL
Now use some other value of exposed operator e.g. "Is greater than" and apply 'Is empty(null)' again, the results will appear perfectly.
Any suggestions ?
Comment | File | Size | Author |
---|---|---|---|
#12 | 1797630.patch | 1.37 KB | damiankloip |
#11 | Date_is_null.PNG | 20.28 KB | webby7097 |
#7 | Capture.png | 56.95 KB | webby7097 |
Comments
Comment #1
qasimzee CreditAttribution: qasimzee commentedping
Comment #2
qasimzee CreditAttribution: qasimzee commentedAdded following lines in date/date_views/includes/date_views_filter_handler_simple.inc after line 102:
The diff looks something like:
I am not sure if it is the correct approach or not. I was unable to create a patch by the way. Please suggest a better solution
Comment #3
jason.fisher CreditAttribution: jason.fisher commentedThis issue is in the latest dev release.
I had to set the range values also for this 'fix' to work:
There must be a better place for this?
Comment #4
jason.fisher CreditAttribution: jason.fisher commentedComment #5
Kiwa CreditAttribution: Kiwa commentedI encountered the same bug today. Neither 'Is empty(null)' nor 'Is not empty (not null)' appear to work correctly for date fields.
Comment #6
Kiwa CreditAttribution: Kiwa commentedSmall update - tried the combined hack of #2 and #3 for a quick fix till a real fix is available, but it did not solve the problem for me.
Comment #7
webby7097 CreditAttribution: webby7097 commentedHaving the same problem, though I don't have the filter exposed. I checked the database and the field I'm checking (field_alert_start_value2) is not null; I have a date field with a start and end, and when the end date is removed, the end date database field is updated to show the same date as the start date. So, despite the fact that when I edit the content it shows no end date, my database shows what's in the attached image.
Comment #8
webby7097 CreditAttribution: webby7097 commentedI've also tested creating a new node with no end date, and the same thing happens - the start date info is added to the end date field.
Comment #9
webby7097 CreditAttribution: webby7097 commentedOne more piece of information - I apologize for the multiple posts, I'm checking these things as they occur to me - the server I have that is still running dates version 2.6 also shows dates in the database as outlined above. However - the view filter works - where an end date is not set in edit, the node is correctly included by the view with the IS NULL filter.
Comment #10
sonicthoughts CreditAttribution: sonicthoughts commentednot sure if this is related but i do not even see the option for null or empty with the date field. are you referring to regex option?
Comment #11
webby7097 CreditAttribution: webby7097 commentedSee the attached image - it shows the filter operator 'is Null'.
Comment #12
damiankloip CreditAttribution: damiankloip commentedI hit the same problem today. It's because the date_views_filter_handler does not override the empty op method like it does for others like between, simple, etc... So it tries to use its field name from views data where it's declared, which is 'date_filter', and not from the date_fields options.
Attached patch fixes this for me.
Comment #13
Fabianx CreditAttribution: Fabianx at Tag1 Consulting commentedRTBC - looks great to me.
Comment #14
chris@frwonline.com CreditAttribution: chris@frwonline.com commentedTried the patches of #12 is not work for both empty / not empty operator, but #3 is work for me with including 'not empty'
Comment #15
podarok#12 merged.
Comment #17
vitalie CreditAttribution: vitalie commentedPatch #12 does not solve the issue. It looks like root cause of it is in Views. There are patches that solve it:
https://www.drupal.org/node/1776332
https://www.drupal.org/node/2445745
Comment #18
RoSk0Assuming fixed because included in 7.x-2.10 release.