Prevent invalid datepicker data to halt JavaScript execution