title: NestJS deserializing @Query() to a DTO with complex types
body: <p>Whilst studying NestJS I encountered an issue, I have the following DTO:</p>
  
  <pre><code>export default class SearchNotesDto {
    query: string;
    createdAfter: Date;
    createdBefore: Date;
  }
  </code></pre>
  
  <p>Which I wish to get when a <code>GET</code> request is made to an endpoint, which is handled by the following function in my controller:</p>
  
  <pre><code>@Get()
  getNotes(@Query() searchNotesDto: SearchNotesDto): Note[] {
    if (Object.keys(searchNotesDto).length) {
      return this.notesService.searchNotes(searchNotesDto);
    }
    return this.notesService.getAllNotes();
  }
  </code></pre>
  
  <p>My problem is that <code>createdAfter</code> and <code>createdBefore</code> are strings in <code>searchNotesDto</code>, and I wish to work with the <code>Date</code> object, is there a way to implicitly convert those fields to a <code>Date</code>?</p>