Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 339
Dinshaw Raje Avatar asked Dec 11 '22 23:12

Dinshaw Raje


2 Answers

Try setting the max option to true

$('.datepicker').pickadate({
  format: 'dd/mm/yyyy',
  selectMonths: true,
  selectYears: 60,
  max: true
});
like image 126
Rajdeep Singh Avatar answered Dec 28 '22 12:12

Rajdeep Singh


Try this;

$('.datepicker').pickadate({
            format: 'dd/mm/yyyy',
            selectMonths: true,
            selectYears: 70,
            max: true
    });
like image 37
Vrushali Pawar Avatar answered Dec 28 '22 11:12

Vrushali Pawar