throw error on invalid date