title: How to validate an array of Date with class validator?
body: <p>I have an array of dates in a post request body that I want to validate:</p>
  <pre><code>{
      &quot;meals&quot;: [...],
      &quot;dates&quot;: [
          &quot;2022-03-06T11:00:00.000Z&quot;,
          &quot;2022-03-07T11:00:00.000Z&quot;
      ]
  }
  </code></pre>
  <p>This is my dto class:</p>
  <pre><code>export class CopyMealsPlanDto {
  ...// Another array
  
    @IsArray()
    @ValidateNested({ each: true })
    @IsDate()
    @Type(() =&gt; Date)
    dates: Date[];
  }
  
  </code></pre>
  <p>But I'm getting this error:</p>
  <pre><code>{
      &quot;statusCode&quot;: 400,
      &quot;message&quot;: [
          &quot;dates must be a Date instance&quot;
      ],
      &quot;error&quot;: &quot;Bad Request&quot;
  }
  </code></pre>