diff --git a/src/lib/filters.js b/src/lib/filters.js index cc979fec..d75ede13 100644 --- a/src/lib/filters.js +++ b/src/lib/filters.js @@ -6,7 +6,7 @@ export function currency(val) { return typeof val === 'number' ? val.toFixed(2) + '€' : val; } -export function date(val, format) { +export function date(val, format = 'YYYY-MM-DD') { if (val == null) return val; if (!(val instanceof Date)) { val = new Date(val); diff --git a/src/pages/Admin/VisitsView.vue b/src/pages/Admin/VisitsView.vue index 79686a50..c2bf260d 100644 --- a/src/pages/Admin/VisitsView.vue +++ b/src/pages/Admin/VisitsView.vue @@ -2,11 +2,10 @@ import { ref, inject, watch, computed } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { useI18n } from 'vue-i18n'; -import { date as qdate } from 'quasar'; import VnInputDate from 'src/components/common/VnInputDate.vue'; -import { formatDateTitle } from 'src/lib/filters.js'; +import { formatDateTitle, date } from 'src/lib/filters.js'; import { useAppStore } from 'stores/app'; import { storeToRefs } from 'pinia'; @@ -39,8 +38,8 @@ const getVisits = async () => { WHERE c.stamp BETWEEN TIMESTAMP(#from,'00:00:00') AND TIMESTAMP(#to,'23:59:59') GROUP BY browser ORDER BY visits DESC`, { - from: qdate.formatDate(from.value, 'YYYY-MM-DD'), - to: qdate.formatDate(to.value, 'YYYY-MM-DD') + from: date(from.value), + to: date(to.value) } ); visitsData.value = visitsResponse; @@ -60,8 +59,8 @@ watch( async () => { await router.replace({ query: { - from: qdate.formatDate(from.value, 'YYYY-MM-DD'), - to: qdate.formatDate(to.value, 'YYYY-MM-DD') + from: date(from.value), + to: date(to.value) } }); await getVisits();