My vue component like this :
<template>
...
<td>{{getDate(item.created_at)}}</td>
...
</template>
<script>
export default {
...
methods: {
getDate(datetime) {
let date = new Date(datetime).toJSON().slice(0,10).replace(/-/g,'/')
return date
}
}
}
</script>
If I console.log(datetime)
, the result : 2018-03-31 18:23:20
I want to get only date and change the format to be : 31 Mar 2018
I try like my component above, but the result like this : 2018/03/31
I try use format method and dateformat method, but it is undefined
How can I solve this problem?