Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue moment not working when used in axios #135

Open
Benoit1980 opened this issue Mar 30, 2020 · 1 comment
Open

vue moment not working when used in axios #135

Benoit1980 opened this issue Mar 30, 2020 · 1 comment

Comments

@Benoit1980
Copy link

Hello,

I am using Laravel with vue.js

I added this to the app.js:
import Moment from 'vue-moment';
Vue.use(Moment);

In my components it works when I used vue moment like this:

{{item.last_login | moment("DD-MM-YYYY HH:mm") }}

But as soon as I try to use it in an axis request it fails. I tried this:

   formData.append('calendar', moment(String(this.field.calendar)).format('YYYY-MM-DD hh:mm')); 

Also tried this:

   formData.append('calendar', $moment(String(this.field.calendar)).format('YYYY-MM-DD hh:mm')); 

Both of them shows this error:

[Vue warn]: Error in v-on handler: "ReferenceError: $moment is not defined"
found in
<AddGamesComponent> at resources/js/components/Listings/AddGamesComponent.vue
       <Root>

Any idea why please?

Thank you.

@BrockReece
Copy link
Collaborator

Try this.$moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants