title: Time conversion from pm to am in Angular 6 component
body: <p>I'm trying to create a form in angular in which we have 2 input fields <code>StartTime</code> and <code>EndTime</code>. In <code>StartTime</code> if we input date and time and it should automatically be updated in <code>Endtime</code> with '+' 1 hour in time.</p>
  
  <p>It is working fine, but when it has to convert from am to pm it does not convert. The time value in  <code>this.endTimeValue</code> while debugging is fine but it dipslays the wrong value in the view (<code>EndTime</code>) while binding.</p>
  
  <p><strong>Html file:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form [formGroup]="myGroup" (ngSubmit)="submit(myGroup.value)"&gt;
      &lt;div class="row row-time"&gt;
          &lt;div class="col-sm-5"&gt;
              &lt;label for="StartTime"&gt;Start Time&lt;/label&gt;
              &lt;input type="datetime-local"  name="StartTime" class="form-control" formControlName="StartTime"&gt;
          &lt;/div&gt;
  
          &lt;div class="col-sm-5 col-sm-offset-2"&gt;
              &lt;label for="EndTime"&gt;End Time&lt;/label&gt;
              &lt;input type="datetime-local"  name="endTime1" class="form-control" formControlName="EndTime" readonly&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;button type="submit" class="btn"&gt;
              Submit Query
          &lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Component file (ts):</strong></p>
  
  <pre class="lang-ts prettyprint-override"><code>myGroup: FormGroup;
  startTimeValue: any;
  endTimeValue : string ;
  
  constructor(private formbuilder:FormBuilder, 
                private datePipe: DatePipe) { }
  
  ngOnInit() {
    this.myGroup = this.formbuilder.group({
      TableName:['', Validators.required],
      CorrelationId:['', Validators.required],
      StartTime:[null, Validators.required],
      EndTime:[null, Validators.required],
      ClientName:['', Validators.required]
    });
  }
  
  
  submit(form){
    this.startTimeValue = form.StartTime;
    var time = this.startTimeValue;
  
    if(time !== null)
    {
      debugger;
      var x = new Date(time);
      x.setHours(x.getHours() + 1);
      this.endTimeValue = x.LocaleString();
      debugger;
      this.myGroup.patchValue({
        EndTime: this.datePipe.transform(this.endTimeValue,"yyyy-MM-ddThh:mm",'+0530')
      })
    }
  }
  </code></pre>