jqueryruby-on-railspickadate

How to give selectYear in pickadate function


Hi I am using pickdate and I am having field this in my view :

<%= f.text_field :date_of_birth,:placeholder =>'Select Date',
                     :class => 'datepicker picker_input' %>

So in this I have this jquery

$('.datepicker').pickadate({
            format: 'dd/mm/yyyy',
            selectMonths: true,
            selectYears: 60
    });

So it gives me years from 1985 to 2045 but I want years from 1945 to current_year. How to fetch this with the help of pickadate. Please guide me. Thanks in advance.


Solution

  • Try setting the max option to true

    $('.datepicker').pickadate({
      format: 'dd/mm/yyyy',
      selectMonths: true,
      selectYears: 60,
      max: true
    });