0

I'm working on a Drupal 8 site where I use a exposed filter to filter on date. I created a simpel version of what I want on simplytest.me (active till 2 feb 09:00 NL time) https://drqs.ply.st (admin/admin).

In this example I created a article with a start and end date.

Start date is 28-02-2018 01:00:00
End date is 28-02-2018 10:00:00

I also created a view with two exposed filters to filter on date range:

Exposed filter 1: >= Startdate
Exposed filter 2: <= Enddate

enter image description here enter image description here enter image description here

When I add 28-02-2018 in both filters the result is null. When I look in the query I see in the query it says 2018-02-27 instead of 2018-02-28 what is going wrong? It looks like it doesn't see the is equal to part of my filter.

enter image description here

My question is if this is normal, and how to make this filter work so it shows the item as i expect it to.

Update: I tried to fix it with this https://www.drupal.org/project/drupal/issues/2627512#comment-12382345 but this only add an hour not a full day.

1

A friend of mine helped me out, the problem was me not adding time to the search query. I found this already along the way in finding a solution but I didn't understand it at that moment. Now I do.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.