title: Angular 8 way to convert json response with string dates to JS date?
body: <p>I know that json does not treat dates in a special way and provides them as strings from the server. Is there a way to provide a json object response that has an ISO date property and map this to a class already with the date property mapped as a JS date?</p>
  <p>Example:</p>
  <p>Json Response:</p>
  <pre><code>{
      &quot;data&quot;: {
          &quot;id&quot;: 1,
          &quot;name&quot;: &quot;John&quot;,
          &quot;surname&quot;: &quot;Smith&quot;,
          &quot;birthDate&quot;: &quot;1986-05-04T22:59:59.000Z&quot;
          &quot;subscriptionDate&quot;: &quot;2020-06-28T14:36:43.498Z&quot;
      }
  }
  </code></pre>
  <p>And I have this class:</p>
  <pre><code>export class User {
  
      id: string;
      name: string;
      surname: string;
      birthDate: Date;
      subscriptionDate: Date;
  
  }
  </code></pre>
  <p>My service method:</p>
  <pre><code>getUser(id: string): Observable&lt;User&gt; {
      return this.http.get&lt;User&gt;(`${this.UrlService}estabelecimentos/${id}`, { headers: this.authenticationService.jwt() }).catch(super.serviceError);
  }
  </code></pre>
  <p>But when I use it in my component birthDate and subscriptionDate are always treated as strings. Is there anyway to transform it to JS dates without having to format the date in every each request by iterating the json response and modifying the object?</p>