Reputation: 31
This is my HTML:
<ion-list>
<ion-item *ngFor="let chat of all_chats" (click)="goChat(chat)">
<ion-avatar item-left>
<img src="{{chat.student.picture_url}}">
</ion-avatar>
<p item-right>{{chat.last_msg.date |date: 'shortTime'}}</p>
<h2>{{chat.student.name}}</h2>
<p>{{chat.last_msg.text}}</p>
<p *ngIf="!chat.last_msg.text">Session Request</p>
</ion-item>
</ion-list>
And when I enter chatlist page I get this error:
ERROR Error: InvalidPipeArgument: '14/08/2017 06:17 AM' for pipe 'DatePipe' , it occured in any pages i use pipe in it
Upvotes: 1
Views: 1235
Reputation: 1301
Using MomentModule
not custome pipe.
try doing this.
1. you need to install the library angular2-moment
npm install angular2-moment --save
2. in your page.module add MomentModule
to imports
then
on html
<h1>{{ chat.last_msg.date| amParse:'DD/MM/YYYY hh:mm A' | amDateFormat:'hh:mm A' }} </h1>
Upvotes: 3