All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

range using entry_date

Chris 19 Sep 2012 14:13 question, complete

Hi

What is the syntax for date ranges using {entry_date}

when I use range:entry_date="2011-01-01;2012-02-31" I am presented with a blank page

Replies

  1. Low 19 Sep 2012 14:21

    Hi Chris,

    The range parameter applies to custom fields only, at the moment. Since this is an entry date, you could use the start_on="" and stop_before="" parameters.

    The fact that you're getting a blank screen is because of a MySQL error that's triggered. That, of course, should never be the case. I'll look into fixing that at least.

  2. Chris 19 Sep 2012 14:33

    thank you... again

  3. jared Laser 6 Feb 2013 16:17

    If Low Search detects that the given channel field for the range is a date field, it will try and convert the given range values to timestamps, if the value is not numeric (in which case it will assume it’s already a timestamp). This will allow custom date ranges as well. For example, setting this value will only match entries where the my_date_field falls in between Jan 1 and Jan 31 of 2012:

    range:my_date_field="2012-01-01;2012-01-31"


    Hey Low- Just wanted to confirm that I still can not query by entry_date? The language here is a little confusing to me so wanted to check with the master.

    thanks!

  4. Low 6 Feb 2013 16:19

    Well, you can, but use the start_on="" and stop_before="" parameters as linked above.

  5. jared Laser 6 Feb 2013 17:14

    Apologies if I'm missing something basic but should those parameters be used on the exp:low_search:results tag?

    I've done the following in my search form:

    <input type="date" name="start_date" value="{low_search_start_date}">


    and the parameter I've added in low_search:results is:

    start_on="{low_search_start_date}"


    The resulting output via template debugging is as follows:

    (0.009482 / 9.74MB) Tag: {exp:low_search:results status="not closed" disable="member_data" query="eyJjb2xsZWN0aW9uIjoicHJlc3NfcmVsZWFzZXMiLCJyZXN1bHRfcGFnZSI6ImFib3V0LXVzXC9zZWFyY2gtcmVzdWx0c1wvJXMiLCJzZWFyY2hfbW9kZSI6ImFsbCIsImtleXdvcmRzIjoiZmFjZSIsInN0YXJ0X2RhdGUiOiIwMjM1LTEyLTMxIn0" start_on="{low_search_start_date}" }

    You can see a gist of what I've done here: https://gist.github.com/imjared/52c34...

  6. Low 6 Feb 2013 17:41

    You can either use it as a parameter in the Results tag:

    {exp:low_search:results query="..." start_on="some-date"}


    Or you can use it in the form as an input element:

    <input name="start_on" value="some-date" />