Forums › Forums › Search & Filter Pro › Search by date for ancient documents
- This topic has 57 replies, 2 voices, and was last updated 7 years, 1 month ago by
Anonymous.
-
Trevor(Private) August 1, 2018 at 12:46 pm #184247
Our date filtering requires that the date is stored in the database in the format YYYYMMDD
For legacy data, the only way to achieve this would be to create a new field for this type of date and write a SQL script to take the old dates and convert them to this new field. It would not be too complex, but you would need to employ the services of a third party SQL coder to do this.
Trevor(Private) August 2, 2018 at 10:36 am #184403Ah, sorry, I misunderstood. You mean the datepicker range is not far enough back or forwards? You would need to add a small amount of javascript to the page to alter the minDate and maxDate of the jQuery UI Datepicker.
I think it would look something like this (untested, but if it doesn’t work I can set it up on my server to check for you), you need to add your dates:
<script> (function ( $ ) { $(jqueryIdentifier).datepicker('option', { minDate: new Date(startDate), maxDate: new Date(endDate) }); }(jQuery)); </script>
jqueryIdentifier needs to be changed to be the identifier for the field with the datepicker.
If you are unsure about this, get back to me and I will see if I can resolve this for you in your site.
Trevor(Private) August 6, 2018 at 12:49 pm #184587Hi
Try it now. This code disables the Year Selection (as you only want 1908, correct?), limits the range to 1908, and sets the default date to January 1, 1908.
jQuery(document).on("sf:init", ".searchandfilter", function(){ jQuery("#search-filter-form-108 .sf-datepicker").datepicker('option',{ yearRange: '1908:1908', defaultDate: '1/1/1908', changeYear: false }); });
-
AuthorPosts