The data is pulled straight from firebase\firestore into vue\nuxt. This is the biding for the object.
So log.Created is a firebase Timespan, toDate() makes it a Date, then moment from\now turns it into "4 hours ago"
<td class="py-3">{{ log.Created.toDate() | moment("from", "now") }}</td>
Problem is, it wasn't 4 hours ago, it was now, but UTC isn't giving me the timezone offset.
I tried setting the default timezone in a moment plugin
import Vue from 'vue'
import VueMoment from 'vue-moment'
import moment from 'moment-timezone'
moment.tz.setDefault(moment.tz.guess())
Vue.use(
VueMoment, {
moment,
})
But I think I may have some lines crossed here...
What's the missing piece of the puzzle?
More debug data
<td class="py-3">
{{ convertDate(log.Created.toDate()) | moment("from", "now") }}<br/><br/>
{{ convertDate(log.Created.toDate()) }} <br/><br/>
{{ log.Created.toDate() }}
</td>
Function:
convertDate: function(date){
return moment(date).tz(moment.tz.guess());
}
...and output
4 hours ago
Tue Oct 22 2019 17:11:59 GMT-0400
Tue Oct 22 2019 17:11:59 GMT-0400 (Eastern Daylight Time)