I'm trying to call moment() in my Vuejs application, I've tried declaring it like so :
methods: {
moment: function () {
return moment();
}
},
and tried to my test it like so :
beforeMount() {
console.log(moment().format('MMMM Do YYYY, h:mm:ss a'))
},
I kept getting
[Vue warn]: Error in beforeMount hook: "ReferenceError: moment is not defined"
Do I need to add a moment to my package.json and run yarn install?
I would like to make it as light as possible since I will only need to access moment() only one page of my application, I rather not load them on all pages.
Please kindly suggest
momentbefore the component definition.