Hey there, I'm currently working on a project using Bootastrap-Vue along with JavaScript and I'm trying to incorporate Moment.js into my code.
However, the time I am getting is not accurate. Can anyone help me out with this issue?
Just a heads up - this is actually my first question here on StackOverflow, so please forgive me if I've made any mistakes in asking it.
Thank you!
var moment = require('moment')
export default {
name: 'something',
data() {
return {
something: [],
currentPage: 1,
total_something: 1,
something_fields: {
id: {
label: 'Id',
sortable: true
},
purpose: {
label: 'Purpose',
sortable: false
},
state: {
label: 'State',
sortable: false
},
updated: {
key: 'updated',
label: 'Updated',
formatter: (value, key, item) => {
return moment(item.updated).calendar();
}
}
},
}
},
created() {
this.loadSomething(0, 10)
},
watch: {
currentPage: function (newPage) {
this.loadSomething(newPage, 10)
}
}, methods: {
loadSomethings(currentPage, limit) {
if (!(Number.isInteger(currentPage) && Number.isInteger(limit))) {
currentPage = 0
limit = 10
}
var offset = (currentPage - 1) * limit
window.API.get('something?offset=' + offset + '&limit=' + limit)
.then(response => {
this.something = response.data.something;
this.total_something s = response.data.total;
console.log(response.data.something)
})
.catch(e => {
this.errors.push(e)
})
}
}
}