title: How to access a parent value inside an array in yup validation
body: <p>I have defined a yup schema</p>
  
  <pre><code>export const ValidationSchema = yup.object().shape({
      dateTo: yup
          .date()
          .required(MandatoryFieldMessage)
  
     uebernachtungen: yup.array().of(
       yup.object().shape({
       ort: yup
              .string()
              .trim()
              .max(100, Maximum100CharactersMessage)
              .required(MandatoryFieldMessage),
  
      bis: yup
              .date()
              .required(MandatoryFieldMessage)
              .max(yup.ref("dateTo"), "display message") }))
  })
  </code></pre>
  
  <p>I just want to use the value of <code>dateTo</code> inside the array, so that all the <code>bis</code> in the <code>uebernachtungen</code> will not be allow do have a value greater than <code>dateTo</code>.</p>
  
  <p>The problem is that I can access items inside the array like <code>ort</code> but I cannot access items out of it like <code>dateTo</code>.</p>
  
  <p>So in this case yup.ref("dateTo") will return undefined but <code>yup.ref("ort")</code> will be correct. It seems that array has its own context and I cannot access to the parent context.</p>
  
  <p>How would be this possible?</p>