I'm trying to set up Grouped filters for Content revision: Changed
in a view. I want the filter to work for Today, Yesterday, Last week, Last month, and Last year. The grouped filters makes that simple enough, and it looks like this:
But all the filters are not filtering correctly.
For the Today filter, this will work.
But When I try to use an Is between
operator for any previous dates, I get an error like this
How do I filter for previous time periods in views?
The Today filter works with Is greater than or equal to
today midnight
. It's the Is between
parameters that the view won't accept.
The existing Today
filter query adds
AND ((node_field_revision.changed >= 1597759242-68400))
to the query, which converts to
GMT: Tuesday, August 18, 2020 2:00:42 PM - 19 hours.
Setting the Yesterday filter with Is less than or equal
to yesterday
adds
AND ((node_field_revision.changed <= 1597759395-154800))
to the query, which converts to
GMT: Tuesday, August 18, 2020 2:03:15 PM - 43 hours
which means the filter will show values from yesterday and today. That's not a yesterday
filter.
So Is between
is the way to go, but any values I try, including yours @Yuseferi, aren't accepted in the UI and so can't adjust to the query accordingly. If the view would accept an Is between
operator, the query would add something like this:
AND ((node_field_revision.changed <= 1597759956-(1597723200-1597636800))
Where
Now: 1597759956
Today: 1597723200
Yesterday: 1597636800
That would be a yesterday query, which Drupal could then adjust for GMT.