perf: date proposal
gitea/hedera-web/pipeline/pr-4922-vueMigration This commit looks good
Details
gitea/hedera-web/pipeline/pr-4922-vueMigration This commit looks good
Details
This commit is contained in:
parent
053b9f8457
commit
5456db8add
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue