jQuery-UI datepicker default date

Try passing in a Date object instead. I can’t see why it doesn’t work in the format you have entered:

<script type="text/javascript">
$(function() {               
    $("#birthdate" ).datepicker({
        changeMonth: true,
        changeYear: true,
        yearRange: '1920:2010',
        dateFormat : 'dd-mm-yy',
        defaultDate: new Date(1985, 00, 01)
    });
});
</script>

http://api.jqueryui.com/datepicker/#option-defaultDate

Specify either an actual date via a
Date object
or as a string in the
current dateFormat, or a number of
days from today (e.g. +7) or a string
of values and periods (‘y’ for years,
‘m’ for months, ‘w’ for weeks, ‘d’ for
days, e.g. ‘+1m +7d’), or null for
today.

Leave a Comment