title: The specified Date value does not conform to the required format Angular 5
body: <p>In my Angular App , I am Showing data from API to component in input fields .</p>
  
  <p>All fields are getting populated but not Input element with type Date</p>
  
  <p>Below is html markup</p>
  
  <pre><code>&lt;input [(ngModel)]="CustomerVM.customer.CustomerDob" type="date" name="MemberDateOfBirth" class="form-control" 
            (blur)="Calculate_Age(CustomerVM.customer.CustomerDob)"&gt;
  </code></pre>
  
  <p>In console it say </p>
  
  <blockquote>
    <p>The specified value "2018-09-21T00:00:00" does not conform to the required format, "yyyy-MM-dd".</p>
  </blockquote>
  
  <p>I made a common function to format date in a service as </p>
  
  <pre><code>FormatDate(iDate: Date) {
  var inputDate:Date= new Date(iDate);
  var formattedDate = new Date(inputDate.getUTCDate(), (inputDate.getUTCMonth() + 1), inputDate.getUTCFullYear());
  return formattedDate;
  </code></pre>
  
  <p>}</p>
  
  <p>and </p>
  
  <pre><code>this.CustomerVM.customer.CustomerDob = this.Helper.FormatDate(this.CustomerVM.customer.CustomerDob);
  </code></pre>
  
  <p>but it does not show value in date field </p>
  
  <p>inside interpolation block we can format value by using pipes</p>
  
  <pre><code>{{DOB | date:'mediumDate'}}
  </code></pre>
  
  <p>Can we do this with ngModel too? cause I don't want a method to format it.</p>
  
  <p>How can I achieve this ?</p>