title: ngbDatepicker set value
body: <p>In my Angular application, template driven form, I have a date of birth field and added ngbDatepicker for that field as given.</p>
  
  <pre><code>&lt;input #dob="ngbDatepicker"
                   (click)="dob.toggle()"
                   [(ngModel)]="model.dob"
                   [ngClass]="{ 'is-invalid': f.submitted &amp;&amp;  dob.invalid }"
                   class="form-control"
                   id="dob"
                   name="dob"
                   required
                   type="text"
                   [disabled]="isDisabled"
                   [class.ash]="isDisabled"
                   [class.highlight]="!isDisabled"
                   ngbDatepicker
            /&gt;
  </code></pre>
  
  <p>I'm getting date of birth form back-end API as <code>dob: "2019-02-16 00:00:00"</code> and I want to pass that value like bellow, </p>
  
  <pre><code> { 
    "year": 2019, 
    "month": 2, 
    "day": 26 
   }
  </code></pre>
  
  <p>because ngbDatepicker get value in that format. This is what I tried to convert my date of birth. </p>
  
  <pre><code>toDate(dob) {
   const [year, month, day] = dob.split('-');
   const obj = { year: year, month: month, day: day.split(' ')[0].trim() };
   console.log('convert date', obj);
   this.model.dob = obj;
   //  this.model.dob ={year: 2017, month: 5, day: 13};
  }
  </code></pre>
  
  <p>The output is <code>{year: "2019", month: "02", day: "16"}</code> , I want to remove quotation marks from this output. I've tried so many methods and unable to get the needed output. 
  I could get <code>{"year": 2019, "month": 02, "day": 16}</code> this output using bellow code. </p>
  
  <pre><code>JSON.stringify({ "year": "2019", "month": "2", "day": "26" }, (key, value) =&gt; !isNaN(+value) ? +value : value);
  </code></pre>
  
  <p>But to set the date I need to set object like this. <code>{year: 2019, month: 2, day: 26 }</code></p>