styler
styler

Reputation: 16481

jQuery UI date picker doesn't obey yearRange correctly

I have created a jQuery datepicker and set the min/max years. When I open the date picker, I see the year range is correct (1999 to 2005). The problem is, if I select a month and a date, the year appears in the input as the current year 2013, even though 2013 doesn't appear as an option and 1999 is selected in the dropdown. How can I set my min year 1999 to be the default?

JS

$( "#datepicker" ).datepicker({
      changeMonth: true,
      changeYear: true,
      yearRange: '1999:2005'
    });

Fiddle: http://jsfiddle.net/qA9NT/12/

Upvotes: 0

Views: 397

Answers (1)

adeneo
adeneo

Reputation: 318182

The default date is always today, set it to something else

$( "#datepicker" ).datepicker({
  changeMonth : true,
  changeYear  : true,
  yearRange   : '1999:2005',
  defaultDate : '12/01/99'
});

FIDDLE

Upvotes: 4

Related Questions