Vue 3 Date time Format in moment.js returns odd year

Viewed 18

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.

0 Answers
Related