Snippet

Using Firebase Timestamp w/Angular Date Pipe

AOAnonymous One· Aug 31, 20221 min read
  • #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, learn how to use these values with Angular DatePipe.

{ seconds:1528515928, nanoseconds:105000000 }

Convert this object into milliseconds or a Date:

<small>{{ story.created.seconds * 1000 | date:'LLL d, yyyy' }}</small>

or

<small>{{ story.created.toMillis() | date:'LLL d, yyyy' }}</small>

or

<small>{{ story.created.toDate() | date:'LLL d, yyyy' }}</small>

0 Comments

Sign in to join the conversation.

Search

Jump to a page, story or project