datepicker 'setDate' method not working as expected
The datepicker 'setDate' method, as described
here http://docs.jquery.com/UI/Datepicker#method-setDate
is not working as expected.
The datepicker is always taking browsers current date. But I want to
set the current date of my choice.
Code:
$(target).datepicker({
dateFormat: $.datepicker.W3C,
closeText: 'X'
});
//set the current date
$(target).datepicker('setDate', currentDateObj);
//checking the current date.
alert($(pTarget).datepicker('getDate'));
where currentDateObj is a javascript date object containing date 1st
august 2009.
When I alert the "getDate" it alerts 1st august 2008, but when I open
the datepicker it displays the browsers current date ie. 31st august
2009 .