I can't get the jqueryUI datepicker to store a date object as it's value opposed to a string. Everything else with the datepicker works fine for me, but the form I am submitting the value to requires a date object and not a string value. The trick is after everytime the user selects a new date, the value being stored in the datepicker should be a date object. I've tried the following:

```
  $('#DP2').datepicker({           
             onSelect: function() {
                $("#DP2").val($("#DP2").datepicker("getDate"));
             }
  }); 

```