我想像这样将两个日期的 Primeng范围日历的输出格式化为"dd/MM/yyyy",我尝试使用管道来转换这些数据。但只是改变了第一次约会,而不是第二次约会。Html代码是:
<div>{{rangeDates | date: 'dd/MM/yyyy'}}</div>
Ts文件是:
rangeDates: Date[];
我收到此错误:
Error: InvalidPipeArgument: 'Unable to convert "Mon Dec 02 2019 00:00:00 GMT+0100 (Central European Standard Time),Tue Dec 10 2019 00:00:00 GMT+0100 (Central European Standard Time)" into a date' for pipe 'DatePipe'
试试这个
<div *ngFor="let range of rangeDates"">
{{range | date: 'dd/MM/yyyy'}}
</div>