title: Deserialise dates properly in angular 5
body: <p>Angular 5 does not seem to properly deserialise json from the API into dates, at least not in an array.  I have a model like this with an array of dates:</p>
  
  <pre><code>    export interface ProcessDefinition {
      _id?: string;  
      processDefinitionName: string;
      myDates: Date[];
  }
  </code></pre>
  
  <p>I have a service class that uses HttpClient to return an observable like so:</p>
  
  <pre><code>    public getItems(): Observable&lt;ProcessDefinition[]&gt; {
      let url = this.apiUrl + this.entityName + '/';
  
      this.loggerService.log(`Getting items with observable via http.`);
      this.loggerService.log(`URL: ` + url);
  
      return this.httpClient.get&lt;ProcessDefinition[]&gt;(url);
  }
  </code></pre>
  
  <p>I call that service from my component, like so:</p>
  
  <pre><code>public loadProcessDefinitionData(): void {
      this.processDefinitionService.getItems().subscribe(items =&gt; {
  
          this.processDefinitions = items;
  
          // Does not help
          // this.processDefinitions.forEach(processDef =&gt;
          //     processDef.day1dates.forEach(day1d =&gt;
          //         day1d = new Date(day1d))
          // );
  
          this.currentProcessDefinition = this.processDefinitions[0] || null;
  
          // Nope
          this.currentProcessDefinition.day1dates.forEach(dat =&gt; dat = new Date(dat));
  
          // Would like this to work, confirming it's a real date.
          console.log(JSON.stringify(this.currentProcessDefinition.day1dates[0].getMonth()));
  
      });
  }
  </code></pre>
  
  <p>Above shows my hamfisted attempts to convert to a 'real date' using the 'new Date' approach discussed in other questions.  I'm sure it would be straightforward for someone more familiar with the syntax.</p>
  
  <p>What I want is for the ProcessDefinition[] observable to contain a myDates array of real dates, confirmable by calling getMonth() successfully on one.  Ideally this conversion would happen in the service so it only has to be in one place.</p>
  
  <p>Thanks</p>