title: Yup validation of empty string
body: <p>I want to setup a minimal validation of user input. First I want to validate that it is not an empty string so something like</p>
  <pre><code>yup.string().min(10);
  </code></pre>
  <p>I also want to validate that it has a date format, so</p>
  <pre><code>yup.string().min(10).date();
  </code></pre>
  <p>I also want to compare it to another date to make sure the range makes sense.</p>
  <p>I have looked at the yup documentation and cannot understand how to accomplish these three tasks. So the &quot;solution&quot; that I have come up with is</p>
  <pre><code>      const hasMaxDateTime =
          value &amp;&amp;
          isDefined(value.maxCreatedAt) &amp;&amp;
          isNaN(Date.parse(value.maxCreatedAt)) === false;
      . . . .
        let maxCreatedAt = yup
          .date()
          .default(undefined)
          .transform((curr, orig) =&gt; orig === '' ? null : curr)
          .typeError('Please enter a valid date');
      . . . .
        if (hasMaxDateTime) {
          minCreatedAt = minCreatedAt.concat(
            minCreatedAt.max(
              yup.ref('maxCreatedAt'),
              'Min created must be less than max created',
            ),
          );
        }
  . . . .
    const schema = yup.object().shape({
      type: yup.number().nullable(),
      statusCode: yup.string().nullable(),
      minCreatedAt,
      maxCreatedAt,
    });
  </code></pre>
  <p>But this doesn't seem to work. I validates that maxdate is not less than mindate just fine. But it doesn't seem to validate that there is an empty string or invalid date?</p>