At the moment in each component I set the locale in each created hook with:
...
created () {
moment.locale('nl')
}
...
Is this possible to do at one spot that rules for all components?
I'm using the vue webpack template.
In VUE 2.5 can be done like this:
/* IN MAIN FILE */
import Moment from 'moment'
Moment.locale(lang)
Vue.prototype.$moment = Moment
/* INSIDE A COMPONENT */
console.log(this.$moment().format("LL"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With