0

I'm trying to display a firebase timestamp in a pretty way. I chose moment to get the job done. In the Database I entered today (6th Sept. 2022) as a datetime value.

Printing the timestamp directly to the screen I get the following returned:

Timestamp(seconds=1662415200, nanoseconds=199000000)

When using formatDate({{blog.createdAt}}) instead I end up getting Invalid date printed to the screen.

I'm using a simple method in my vue project:

methods: { 
  formatDate(value){
    if (value) {
      return moment(String(value)).format('MMM Do, YYYY');
    }
  },
},

When adding *1000 to my value (for testing purpose) I end up with getting Sep 6th, 3991 which I don't quite understand. Thankful for any input.

lechnerio
  • 884
  • 1
  • 16
  • 44
  • Does this answer your question? [Firebase TIMESTAMP to date and Time](https://stackoverflow.com/questions/34718668/firebase-timestamp-to-date-and-time) – yoduh Sep 06 '22 at 14:33

0 Answers0