I'm using the following script below to add "+1 day" to second field (#returningdate). But if a user chooses on the #leavingdate 12/31/2009 they would get a #returningdate of 12/32/2009 instead of 01/01/2010. This happens with any end month date.
<script type="text/javascript">
$(function() {
$("#leavingDate").change(function(){
$("#returningDate").datepicker( 'setDate' , "+1 day" );
var date = this.value.split("/");
$("#returningDate").val(date[0]+'/'+(parseInt(date[1])+1)+'/'+date[2]);
}).datepicker();
$("#returningDate").datepicker();
});
</script>