Forums Forums Search & Filter Pro Search by date for ancient documents

Viewing 10 posts - 1 through 10 (of 58 total)
  • Anonymous
    #184238

    I’m making a website with an archive of ancient documents – http://newspapers1908.tolstoy.ru/ I need to implement a search by date. The oldest document is dated 1 August 1908. But by default the form shows the current date and search range plus / minus 10 years: 2008-2028. August 1, 1908 can only be entered manually-1/08/1908. Is it possible to make the year of the earliest document (1908) appear by default? Thank You!

    Trevor
    #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.

    Anonymous
    #184393

    What if I use a date range? Can I set a start and end date?

    Trevor
    #184403

    Ah, 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.

    Anonymous
    #184491
    This reply has been marked as private.
    Trevor
    #184520
    This reply has been marked as private.
    Anonymous
    #184524

    Trevor, thank you very much for Your work, I hope you will succeed.

    Trevor
    #184528
    This reply has been marked as private.
    Anonymous
    #184530

    That’s OK, thank you!

    Trevor
    #184587

    Hi

    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
      });
    });
Viewing 10 posts - 1 through 10 (of 58 total)