Trying to display date differences in a human-readable format using the guide found here:
I'm attempting to incorporate DayJS as a component in my VueJS application like this:
<script src="{{ asset('/vendor/vuejs/vue.js') }}" type="text/javascript"></script>
<script src="{{ asset('/vendor/vue-dayjs/dayjs.min.js') }}"></script>
<script type="text/javascript">
Vue.component("dayjs", dayjs);
Vue.filter('formatDateDiffForHumans', function(value){
if (!value) return null;
return dayjs(value).fromNow();
});
var app = new Vue({
el:'#vue_app',
data:{
......
}
});
</script>
.....
<span>@{{ t.object.created_at | formatDateDiffForHumans }}</span>
However, upon implementation, I encountered the following error:
[Vue warn]: Error in render: "TypeError: dayjs(...).fromNow is not a function"
What could be causing this issue?