Reputation: 95
Im trying to convert the Date in the "dd-mm-yyyy" format with no success.
Ive tried to use this.datePipe.transform(this.filter.offerExpiration,"yyyy-MM-dd")
but it doesnt work (the date doesnt change at all).
What can I do?
Thank you for the help.
Upvotes: 1
Views: 276
Reputation: 967
If you use the following code, your date will not change:
this.datePipe.transform(this.filter.offerExpiration,"yyyy-MM-dd");
console.log(this.filter.offerExpiration);
The datePipe returns the modified date. This should do the trick:
let formattedDate = this.datePipe.transform(this.filter.offerExpiration,"yyyy-MM-dd");
console.log(formattedDate);
Upvotes: 3