mirror of
https://github.com/Dannecron/ich-lerne-deutsch.git
synced 2025-12-25 12:52:35 +03:00
add filter formattedDate
This commit is contained in:
12
src/filters/formattedDate.js
Normal file
12
src/filters/formattedDate.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const formattedDate = (value) => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Date) {
|
||||
return value.toLocaleDateString();
|
||||
}
|
||||
|
||||
return value.toDate().toLocaleDateString();
|
||||
};
|
||||
|
||||
export default formattedDate;
|
||||
@@ -13,6 +13,7 @@ import App from '@/App.vue';
|
||||
import router from '@/router';
|
||||
import store from '@/store';
|
||||
import firebaseConfig from '@/config/firebase';
|
||||
import formattedDate from '@/filters/formattedDate';
|
||||
|
||||
const firebaseApp = firebase.initializeApp(firebaseConfig);
|
||||
const db = firebaseApp.firestore();
|
||||
@@ -28,6 +29,8 @@ Vue.use(VuetifyConfirm, {
|
||||
});
|
||||
Vue.use(VueYouTubeEmbed);
|
||||
|
||||
Vue.filter('formattedDate', formattedDate);
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
|
||||
Reference in New Issue
Block a user