I am using Solspace's Date Field Filter to group sales on a site. I need to display everything from yesterday (relative to current date) and older. I also need to do this moving forward (forecasting), so tomorrow (relative to current date). All of the dates being checked are custom date fields in EE's native date fieldtype though.
So instead of something like this:
{exp:channel:entries
date_field="{sale_dates_and_times:date}"
date_field_start="{current_time format='%Y-%m-%d %h:%i %A'}"
channel="sales"
limit="5"
orderby="{sale_dates_and_times:date}"
sort="desc"
paginate="bottom"
dynamic="no"
}
I would need the date_field_start
to be yesterday or tomorrow.
Is there a way to do this easily? I think I am making this harder on myself than it needs to be.
Thanks
****UPDATE****
So I have the date coming in like I need it now, but I am not receiving filtered results...
I used the DT Plugin, thanks to Sam for pointing that out, to get the dates needed. I verified the dates by rendering them out. Since it didn't work, I even tried to use Stash to pass that into the channel entries tag. Still no good. Is there something I am doing wrong Solspace? My date field is in a grid like this:
Grid Field = {sale_dates_and_times}
Sub Fields = date | opening_time | closing_time or
{sale_dates_and_times:date}
{sale_dates_and_times:opening_time}
{sale_dates_and_times:closing_time}
I have this now:
{exp:stash:set name="previous"}{exp:dt day='-3' format='%Y-%m-%d %h:%i %A'}{/exp:stash:set}
This renders as 2015-09-11 12:57 PM
{exp:channel:entries
date_field="{sale_dates_and_times:date}"
date_field_start="{exp:stash:get name='previous'}"
channel='sale'
limit='5'
orderby="{sale_dates_and_times:date}"
sort="asc"
paginate="bottom"
dynamic="no"
}
In my test I should just see 1 entry since there is one set to a previous date range, one set to current date ranges, and one set for a future date range. However, I am getting all entries returned.
These are with the following dates:
Entry-1:
Friday 09-11-2015 — 9:00am-9:00am
Saturday 09-12-2015 — 9:00am-9:00am
Sunday 09-13-2015 — 8:00am-8:00am
Entry-2:
Tuesday 09-01-2015 — 9:00am-9:00am
Wednesday 09-02-2015 — 9:00am-9:00am
Thursday 09-03-2015 — 8:00am-8:00am
Entry-3:
Friday 09-25-2015 — 9:00am-9:00am
Saturday 09-26-2015 — 9:00am-9:00am
Sunday 09-27-2015 — 8:00am-8:00am
Why would all three be rendering in this case?
Thanks