diff --git a/src/pages/Customer/Card/CustomerConsumption.vue b/src/pages/Customer/Card/CustomerConsumption.vue index e41c22ee6..640e37ed3 100644 --- a/src/pages/Customer/Card/CustomerConsumption.vue +++ b/src/pages/Customer/Card/CustomerConsumption.vue @@ -2,7 +2,7 @@ import { ref, computed, onBeforeMount } from 'vue'; import axios from 'axios'; import { useI18n } from 'vue-i18n'; -import { toDate } from 'src/filters/index'; +import { dateRange, toDate } from 'src/filters/index'; import { useRoute } from 'vue-router'; import VnTable from 'components/VnTable/VnTable.vue'; @@ -140,14 +140,9 @@ const updateDateParams = (value, params) => { const { dated, previousDays, scopeDays } = campaign; const _date = new Date(dated); - _date.setHours(0, 0, 0, 0); - params.from = new Date( - new Date(dated).setDate(_date.getDate() - previousDays) - ).toISOString(); - _date.setHours(23, 59, 59, 59); - params.to = new Date( - new Date(dated).setDate(_date.getDate() + scopeDays) - ).toISOString(); + const [from, to] = dateRange(_date); + params.from = new Date(from.setDate(from.getDate() - previousDays)).toISOString(); + params.to = new Date(to.setDate(to.getDate() + scopeDays)).toISOString(); return params; };