tags:

views:

155

answers:

2

I am having problems getting my head around the syntax to set the date range for the JqueryUI calendar.

this...

$(function() {
    $('#DOB').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'd MM yy',
        minDate: new Date(1900, 11 - 1, 6)

    });
});

is strangely giving me a range of the years 2000 - 2020. ALl I want to do is start at 1900. End date can be today.

A: 

if you choiced dateFormat: 'd MM yy' and range from 1900 to 20* you get the conflict with this values: "1 February, 10" - is it "01.02.1910" or "01.02.2010"? May be, if you change the dateFormat the problem would disappeared

Adelf
+1  A: 

The default yearRange shows +10 and -10 years from the current date (hence why you see 2000 to 2020)

Try adding:

yearRange: '1900:2010'

to display the years 1900 to 2010 in the year drop-down.

$(function() {
    $('#DOB').datepicker({
        changeMonth: true,
        changeYear: true,
        dateFormat: 'd MM yy',
        minDate: new Date(1900, 11 - 1, 6),
        yearRange: '1900:2010'

    });
});
akiller
awesome, thanks akiller!
swisstony