Forums › Forums › Search & Filter Pro › Display results greater than date
Tagged: date range
- This topic has 7 replies, 2 voices, and was last updated 5 years, 8 months ago by Trevor.
-
Anonymous(Private) March 11, 2019 at 12:05 pm #204619
Hello,
We’re trying to display search results that are greater than a date.
This date will be selected by the user, and pulled from a custom Meta Key that we’ve set up.
We’ve got this working as a date range currently, but that relies on a user selecting two dates – and doesn’t allow for indefinite dates.
Is it possible to display results greater than a single selected date?
Thanks
Anonymous(Private) March 11, 2019 at 2:08 pm #204648Just having a look into this, and wondered how I go about targeting the TO date field.
It appears that the ID for this field is randomised on each load:<input class=”sf-datepicker sf-input-date sf-input-text hasDatepicker” name=”_sfm_startdate[]” type=”text” value=”” title=”” id=”dp1552313064514″>
Trevor(Private) March 11, 2019 at 2:56 pm #204660It will be the last-child of the containing field. Here is one I made a while ago:
.sf-field-post-meta-transportation_dummy_start_date > ul > li:last-child { display: none; }
And the javascript I used (your need may vary, for example the date format):
<script type="text/javascript"> jQuery( document ).ready(function($){ jQuery('li:last-child input[name="_sfm_transportation_dummy_start_date[]"]').val('31/12/2050'); }); </script>
Anonymous(Private) March 19, 2019 at 9:00 am #205587Hi Trevor,
Many thanks for the above.
We’ve got an odd issue whereby the “To” date being set is causing differences in the results to what we previously had.
For example, if we leave both the “From” and “To” date empty prior to the code you provided we’re seeing a set of resutlts.
However, if we populate the “To” date with 31/12/2050 and leave the “From” field blank we don’t retrieve any results.
I can confirm that we don’t have any resutls that exceed the 31/12/2050 date.
Let me know if you need any further information.
Thanks.
-
AuthorPosts