localgovdrupal / localgov_events

Events for LocalGov Drupal.
GNU General Public License v2.0
1 stars 0 forks source link

Events view hook_views_query_alter prevents events from displaying #20

Open finnlewis opened 3 years ago

finnlewis commented 3 years ago

The hook_views_query_alter in https://github.com/localgovdrupal/localgov_events/blob/master/localgov_events.module#L188 works fine when an end date is set, but if left empty when other filters are set, in incorrectly sets the end date to today + 1. It should only do this if the end date is set.

finnlewis commented 3 years ago

I'm adding an additional check to this.

    $filters = $view->getExposedInput();
    if ( isset($filters['end']) && strlen($filters['end']) > 0 ) {
      $filters['end'] = date('Y-m-d', strtotime($filters['end'] . ' + 1 days'));;
      $view->setExposedInput($filters);
    }