<form>
<p-calendar [(ngModel)]="report.incidentTime" [showTime]="true" [ngModelOptions]="{standalone: true}" [maxDate]="maxDateValue"
(ngModelChange)="validateTime($event)"></p-calendar>
<button type="button" class="btn btn-primary ripple" (click)="saveReport()" >Save</button>
</form>
Utilizing primeNg calendar for showcasing the calendar.
saveReport() {
console.log("Executing save function");
this.validateFields();
let temp = this.report;
console.log("Time : "+this.report.incidentTime);
console.log("Object : "+JSON.stringify(this.report));
}
where incidentTime: Date;, is a data type of Date.
Time: Mon Oct 02 2017 09:34:39 GMT+0400 (Arabian Standard Time)
Object : {"incidentTime":"2017-10-02T05:34:39.000Z","reportingType":"I"}
Two outputs are showing different times. Why is this happening? How can I ensure that the time displayed in the Object matches the selected time without being 4 hours behind?