Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue.js and vue-moment: "Failed to resolve filter: moment"

Trying to use vue-moment. The simplest possible example from the documentation doesn't work: https://jsfiddle.net/rjcpz9wt/

<span>{{ new Date() | moment "dddd, MMMM Do YYYY" }}</span>

Gives:

[Vue warn]: Failed to resolve filter: moment

What is going on?

like image 635
Kunto Handoko Avatar asked Sep 20 '16 18:09

Kunto Handoko


1 Answers

vue-moment is broken.

You can't use it by just adding it as a <script> tag. Currently it only works if you use compile it with webpack or browserify, see this issue for updates.

It used to work well on the original version: https://github.com/brockpetrie/vue-moment/tree/fd6fcb901415c1df4c5abb81870d49b346d3732f

See the original version working here: https://jsfiddle.net/gerardog/vaw33sn2/

Also, on Fiddle dont link to files in https://raw.github.com/ , use this nice workaround

like image 63
Gerardo Grignoli Avatar answered Nov 14 '22 23:11

Gerardo Grignoli