Check if it is a valid date before saving