Date picker returning incorrect date time

Hi i have added a date time picker in a page.

But after using the datepipe to convert it to date time, it is returning wrong date and time

Find below my code :-


<ion-item id="datePick" no-lines>
        <ion-label [class]="dateClass">Choose pick up date to continue</ion-label>
        <ion-datetime  min="{{minDate}}"  displayFormat="MMM DD, YYYY HH:mm" [(ngModel)]="myDate" ></ion-datetime>


let convertedDate =this.datepipe.transform(this.myDate, 'MM/dd/yyyy hh:mm a');

convertedDate is providing incorrect date time.

Please help me fix this issue . What am i doing wrong ? Is there any other way to convert date time ?

Maybe it has sth. to do with Timezones? How is the datetime wrong? can you provide the value that is returned and the value that should be returned?

i choose march 11 2018 , time - 08:22 am

but the value getting retured is 03/11/2018 01:52 PM . time is wrong

Yes, the issue is with timezones. How can i set timezone for the date time picker

Fixed this by first

let convertedDate = new Date(

and the passing this to datepipe