Using Firebase Timestamp w/Angular Date Pipe
- #Angular
- #Firebase
- #Date
Using Firebase Timestamp w/Angular Date Pipe
Firebase returns a timestamp field of a document as an object with two properties: seconds and nanoseconds, see how to use these values with Angular DatePipe.
{ seconds:1528515928, nanoseconds:105000000 }
So you need to convert this object into milliseconds or a Date:
<small>{{ story.created_on.seconds * 1000 | date:'LLL d, yyyy' }}</small>
or
<small>{{ story.created_on.toMillis() | date:'LLL d, yyyy' }}</small>
or
<small>{{ story.created_on.toDate() | date:'LLL d, yyyy' }}</small>
0 Comments
Sign in to join the conversation.