From beaa08e0270e22a7cffa26e1714c3d8d6eff0b94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Vi=C3=A9not?= Date: Mon, 18 Mar 2024 15:22:25 +0100 Subject: [PATCH] Adjust processing of startDate and endDate in TransactionDownloadDialog. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon ViƩnot --- .../download/TransactionDownloadDialog.vue | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/download/TransactionDownloadDialog.vue b/src/components/download/TransactionDownloadDialog.vue index ba40215eb..9fc98c472 100644 --- a/src/components/download/TransactionDownloadDialog.vue +++ b/src/components/download/TransactionDownloadDialog.vue @@ -158,17 +158,33 @@ export default defineComponent({ const lastMidnight = new Date(new Date().setHours(0, 0, 0, 0)) const nextMidnight = new Date(new Date().setHours(24, 0, 0, 0)) - const selectedStartDate = ref(lastMidnight) - const startDate = computed( - () => selectedStartDate.value ? new Date(selectedStartDate.value?.setHours(0,0,0,0)) : null + const selectedStartDate = ref(new Date()) + const startDate = computed(() => { + let result + if (selectedStartDate.value != null) { + result = new Date(selectedStartDate.value) + result.setHours(0, 0, 0, 0) + } else { + result = null + } + return result + } ) const isStartDateValid = computed( () => startDate.value !== null && startDate.value <= lastMidnight ) - const selectedEndDate = ref(nextMidnight) - const endDate = computed( - () => selectedEndDate.value ? new Date(selectedEndDate.value?.setHours(0,0,0,0)) : null + const selectedEndDate = ref(new Date()) + const endDate = computed(() => { + let result + if (selectedEndDate.value != null) { + result = new Date(selectedEndDate.value) + result.setHours(24, 0, 0, 0) + } else { + result = null + } + return result + } ) const isEndDateValid = computed( () => endDate.value !== null