title: Yup validation is not working for nested objects for date keys if we have same name
body: <p>I have used the YUP validation. I need to add validation of startDate and endDate from parent under milestones.</p>
  <pre class="lang-js prettyprint-override"><code>export const validationSchema = Yup.object().shape(
    {
      name: requiredString,
      startDate: Yup.date()
        .nullable()
        .when('endDate', {
          is: (val) =&gt; val,
          then: Yup.date().nullable().max(Yup.ref('endDate'), 'message'),
        }),
      endDate: Yup.date()
        .nullable()
        .when('startDate', {
          is: (val) =&gt; val,
          then: Yup.date().nullable().min(Yup.ref('startDate'), 'message'),
        }),
      milestones: Yup.array().of(
        Yup.object().shape(
          {
            name: requiredString,
            startDate: Yup.date()
              .nullable()
              .when('endDate', {
                is: (val) =&gt; val,
                then: Yup.date().nullable().max(Yup.ref('endDate'), 'message'),
              }),
            endDate: Yup.date()
              .nullable()
              .when('startDate', {
                is: (val) =&gt; val,
                then: Yup.date().nullable().min(Yup.ref('startDate'), 'message'),
              }),
          },
          [['startDate', 'endDate']]
        )
      ),
    },
    [['startDate', 'endDate']]
  );
  </code></pre>