Cant Install moment()
How to apply moment in inertia?
In the resources/js/app.js (comments for brevity) and assuming you have installed moment using NPM/yarn
import moment from "moment";
// ...
createInertiaApp({
// ..
setup({ el, app, props, plugin }) {
return createApp({ render: () => h(app, props) })
// ...
.mixin({ methods: { route, moment} })
// ...
.mount(el);
},
})
@tykus then how will i apply it to my component?
@eskiesirius just use the moment function in the component; it is mixed into the Vue app
@tykus yeah i tried but it didn't worked.. Uncaught (in promise) ReferenceError: moment is not defined error..
@tykus it worked.. i just reImport moment in my component
@tykus i mean using your method to use the moment as global didn't worked.. what i did was i just import the moment directly to the component..
Please or to participate in this conversation.