diff --git a/src/pages/Item/Card/ItemLastEntries.vue b/src/pages/Item/Card/ItemLastEntries.vue index 5200db239..9071cc6eb 100644 --- a/src/pages/Item/Card/ItemLastEntries.vue +++ b/src/pages/Item/Card/ItemLastEntries.vue @@ -2,7 +2,7 @@ import { onMounted, computed, onUnmounted, reactive, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; - +import { dateRange } from 'src/filters'; import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue'; import VnInputDate from 'src/components/common/VnInputDate.vue'; @@ -29,28 +29,19 @@ const exprBuilder = (param, value) => { case 'landed': return { 'tr.landed': { - between: getDateRange(value), + between: dateRange(value), }, }; } }; -const dateRange = reactive({ +const datedRange = reactive({ from: null, to: null, }); -const getDateRange = (val) => { - const minHour = new Date(val); - minHour.setHours(0, 0, 0, 0); - const maxHour = new Date(val); - maxHour.setHours(23, 59, 59, 59); - - return [minHour, maxHour]; -}; - const from = computed({ - get: () => dateRange.from, + get: () => datedRange.from, set: (val) => { updateFrom(val); updateFilter(); @@ -58,7 +49,7 @@ const from = computed({ }); const to = computed({ - get: () => dateRange.to, + get: () => datedRange.to, set: (val) => { updateTo(val); updateFilter(); @@ -173,17 +164,17 @@ const fetchItemLastEntries = async () => { const updateFrom = async (date) => { date.setHours(0, 0, 0, 0); - dateRange.from = date.toISOString(); + datedRange.from = date.toISOString(); }; const updateTo = async (date) => { date.setHours(23, 59, 59, 59); - dateRange.to = date.toISOString(); + datedRange.to = date.toISOString(); }; const updateFilter = async () => { arrayData.store.userFilter.where.landed = { - between: [dateRange.from, dateRange.to], + between: [datedRange.from, datedRange.to], }; await fetchItemLastEntries(); }; diff --git a/src/pages/Item/ItemRequest.vue b/src/pages/Item/ItemRequest.vue index 1872ad859..735f3a7b7 100644 --- a/src/pages/Item/ItemRequest.vue +++ b/src/pages/Item/ItemRequest.vue @@ -1,7 +1,7 @@