Events filter - End date not working
The end date of the events filter is not working. Events past the end date are showing in the filtered results.
- At a glance, it appears that one of the core updates may have broken the patch that allows greater than or less than
Need to investigate further (Brian Canini - Apr 18, 2019)
- The reason start date is working is because event has a filter to only show events after current day. If removed all events show regardless of if filter is set (Brian Canini - Apr 22, 2019)
- patch actually became part of drupal core as of 8.6 (Brian Canini - Apr 22, 2019)
- I think I see the problem now. It looks like end date works when it's not in it's own filter group but then we can't have the start date beyond current because of the filter that hides things once the date has passed (Brian Canini - Apr 22, 2019)
- Tested module - views conditional - doesn't do what we need it to for this - only adds conditionals to fields NOT filters
Testing patch - https://www.drupal.org/project/drupal/issues/2559961 (Brian Canini - Apr 23, 2019)
- patch does nothing:( (Brian Canini - Apr 23, 2019)
- I ended up removing the additional (now) end date filter and adding the now default value to the exposed end date filter. Then I wrote some jquery to remove the word "now" from the input field if it exists
jquery code:
if(jQuery("#views-exposed-form-events-page-1").length) {
if(jQuery("#views-exposed-form-events-page-1 #edit-field-evt-date-range-end-value-1").val() == "now") {
jQuery("#views-exposed-form-events-page-1 #edit-field-evt-date-range-end-value-1").val("");
}
}
Helpful: https://stackoverflow.com/questions/11755080/jquery-clear-input-default-value (Brian Canini - Apr 25, 2019)
- We need the filter results to include the end date. The May 15 event should show for the query below. https://pt-04242019-d8-clean-source.pantheonsite.io/events?field_evt_date_range_end_value_1=03/01/2019&field_evt_date_range_value=05/15/2019 (Eva Dale - Apr 25, 2019)
- Found the following: https://drupal.stackexchange.com/questions/254894/drupal-8-exposed-date-filter-not-working-with-greater-than-or-less-than-and
By not entering a time in the search field (so searching for 28-02-2018) the search will go to 28-02-2018 00:00:00 which is the same as 27-02-2018 23:59:59. So what I had to do was search for 28-02-2018 23:59:59 instead, when entering this in the search field, the right items do show.
Sadly, he didn't leave an actual solution but, at least this gives a clue as to what's going on (Brian Canini - Apr 25, 2019)
- Tried Single Date Time Picker module - doesn't work for our needs - this module does not work with date range (Brian Canini - Apr 26, 2019)
- Tried Date Popup module - doesn't give time option (Brian Canini - Apr 26, 2019)
- tried patch - nope https://www.drupal.org/project/drupal/issues/2832058 (Brian Canini - Apr 30, 2019)
- Tried patch - nope https://www.drupal.org/project/drupal/issues/2842409 (Brian Canini - Jun 20, 2019)