Setting defaultDate after init

Setting defaultDate after init


Hello All,
Having an issue setting the date of a datepicker after it's been
initialized. I call the init function on page load, and the
datepicker resides in a hidden div that becomes a modal dialog. When
they click on an area of the page the dialog is launched and it's at
this time that I want to set the date. Here is some code I'm using to
try and achieve this, it's not working ,but it's not erroring either.
//THE INIT FUNCTION
    $('#update_appt_datepicker').datepicker({
        showButtonPanel: true,
        dateFormat: 'DD MM dd, yy',
        altField: '#update_formated_date',
        altFormat: 'yy-mm-dd'
    });
//THEN LATER
$('#appt_list_ul li').click(function(){
                            //get the appt details
                            var cur_date     = $('#edit_formated_date').val(); //2009-03-15
                            var date_pieces = cur_date.split('-');
                            var date_obj    = new Date(date_pieces[0],(date_pieces[1] * 1) -
1,date_pieces[2]);
                            //date_obj.setFullYear(date_pieces[0],(date_pieces[1] * 1) -
1,date_pieces[2]);
                            //passin the date to the edit calendar
                            $('#update_appt_datepicker').datepicker('option',
{defaultDate:date_obj});
                            //pass in the time
                            //open the dialog
                            $("#edit_appt_dialog").dialog('open');
                        });
I get the modal popup just fine, however the date picker has the
current date selected instead of the one I'm trying to pass to it. If
I alert the date_obj I get the full string of the date, so I know I
have a workable date object.
Thanks!
Greg