title: Validate fields conditionally based on another field in Yup and Formik
body: <p>I have a problem in validation. I wanted that if <code>access</code> value is 1 then you can select the <code>start_date</code> and <code>end_date</code> BUT if the value of <code>access</code> is not 1, then you can only select today.</p>
  <p>Codesandbox</p>
  <p><a href="https://codesandbox.io/s/formik-material-ui-date-picker-with-yup-validate-forked-s9ne8?file=/src/index.js" rel="nofollow noreferrer"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="Edit 63973773/error-when-setting-an-input-in-reactjs-label-is-over-overwrites-the-value-of (forked)" /></a></p>
  <pre><code>export const validationSchema = yup.object().shape({
    access: yup.number().nullable(),
    start_date: yup.string().required('Select start date'),
    end_date: yup.string().required('Select end date'),
  });
  </code></pre>