setting date to null if invalid date is selected through input