Why am I getting an error message for the date when the date was selected from the date box?