handles invalid dates