The problem is that when I clear the dates (by deleting the textbox values), th
Did you try:
$('selector').datepicker('setDate', null);
That should work according to the API documentation