I am newbie to laravel 8 inertia vue. I changed the locale in .env to 'fr'
Then I created global filters in app.js
Vue.filter('formatDateLong', function(value) {
if (value) {
return moment(String(value)).format('LLLL');
}
});
Vue.filter('formatDateShort', function(value) {
if (value) {
return moment(String(value)).format('lll');
}
});
Vue.filter('formatDateTimeVeryShort', function(value) {
if (value) {
return moment(String(value)).format('ll');
}
});
new Vue({
render: (h) =>
h(InertiaApp, {
props: {
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (name) => require(`./Pages/${name}`).default,
},
}),
}).$mount(app);
In vue template I use thing like this :
{{post.created_at|formatDateLong}} or {{post.created_at|formatDateVeryShort}}
The filters seems to be applied but unfortunately everything stay in English.
Any idea ?