locale is the fourth argument of the DatePipe transform and timezone is the third argument. Currently you have the locale as the third argument. I'd probably configure your locale like this (and the date pipe will automatically work for your locale without specifying):
Missing locale data for the locale "XXX" with angular
transform takes either a javascript date or an ISO date string so I'm guessing your dates (projectStartDate, projectEndDate) are strings that aren't in the ISO format? The error message implies that one of those fields has the entire value of 12-01-2020 - 13-02-2020
sample code with ISO date string
startDate = '2020-01-12';
endDate = '2020-02-13';
formattedStartDate = this.datePipe.transform(this.startDate);
formattedEndDate = this.datePipe.transform(this.endDate);
constructor(private datePipe: DatePipe) {
console.log(`${this.formattedStartDate} - ${this.formattedEndDate}`);
}
Sample code with javascript date
startDate = new Date('2020-01-12');
endDate = new Date('2020-02-13');
formattedStartDate = this.datePipe.transform(this.startDate, 'yyyy-MM-dd');
formattedEndDate = this.datePipe.transform(this.endDate, 'yyyy-MM-dd');
constructor(private datePipe: DatePipe) {
console.log(`${this.formattedStartDate} - ${this.formattedEndDate}`);
}
If your dates are strings in a dd-MM-yyyy format, you can parse them with a library like luxon:
npm i luxon
And import
import { DateTime } from 'luxon';
And parse
startDate = DateTime.fromFormat("12-01-2020", "dd-MM-yyyy").toISODate();
As a final note it's a little funny to put the dates in an ISO date format (yyyy-MM-dd) and then format them in the same format. The pipe makes more sense, particularly with you app locale set, if you want to use formats such as mediumDate (the default) which might display 12 ene. 2020