dd/mm/yyyy format for datepipe.transform method in .ts file

I need to parse a csv file which has a date column in dd/mm/yyyy format. And i need to change this date to yyyy-mm-dd format to save it in database. So I use datepipe.transform method for this as below

this.datePipe.transform(x[this.csvcolumns.colDOB], 'yyyy-MM-dd','de')

By default the datepipe only accepts mm/dd/yyyy. So for a date like 18/02/2000,the datepipe throws an error as below.

InvalidPipeArgument: 'Unable to convert "13/02/2012" into a date' for pipe 'DatePipe'

I’ve added the following configuration in app.module.ts, so the datepipe in an html page gives me a date in dd.mm.yyyy format.

import { registerLocaleData } from '@angular/common'; import localeDe from '@angular/common/locales/de'; registerLocaleData(localeDe);

Today is {{todayDate | date:'shortDate'}}

So why is it not working for datepipe.transform method in a ts file? Do i need to make any changes in the constructor for that? My constructor looks like below

providers: [DatePipe] })

export class BulkuploadPage implements OnInit { constructor(private datePipe: DatePipe) { } ngOnInit() {}