Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 date pipe

I am using this code:

{{today | date:'General.dateFormat | translate'}}

where General.dateFormat is a format MM.dd.yyyy stored in my language JSON file. But it is printed as 5 22, 2017 AenerPMl.22PMteFor35PMt | trPMn24lPMte

I think there is an issue with multiple pipe. If I replace General.dateFormat | translate with MM.dd.yyyy it works as it should. How do I give the format from my language json file using the translate pipe?

like image 590
Tim Liberty Avatar asked Oct 29 '22 07:10

Tim Liberty


1 Answers

You passed translate pipe as a value to date filters. pass value directly instead of passing General.dateFormat as a string. please try the below code

{{today | date: translate:'General.dateFormat'}}
like image 199
Shahid Ahmad Avatar answered Nov 11 '22 11:11

Shahid Ahmad