Use datepicker.parseDate instead of new Date.