From 075d34d8f52c255bb34a66be7b0e29e3d5a2c27d Mon Sep 17 00:00:00 2001 From: jq1836 <95712150+jq1836@users.noreply.github.com> Date: Mon, 25 Sep 2023 01:37:49 +0800 Subject: [PATCH] [#2027] Fix date range bug (#2034) Currently, users are unable to select a zoom range that includes the until date. This results in misleading data being presented to users. --- frontend/src/components/c-summary-charts.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/c-summary-charts.vue b/frontend/src/components/c-summary-charts.vue index bb5ab4bb86..ea52675ddb 100644 --- a/frontend/src/components/c-summary-charts.vue +++ b/frontend/src/components/c-summary-charts.vue @@ -535,7 +535,9 @@ export default defineComponent({ // skip if accidentally clicked on ramp chart if (this.drags.length === 2 && this.drags[1] - this.drags[0]) { - const tdiff = (new Date(this.filterUntilDate)).valueOf() - (new Date(this.filterSinceDate)).valueOf(); + // additional day was added to include the date represented by filterUntilDate + const tdiff = (new Date(this.filterUntilDate)).valueOf() - (new Date(this.filterSinceDate)).valueOf() + + window.DAY_IN_MS; const idxs = this.drags.map((x) => (x * tdiff) / 100); const tsince = window.getDateStr(new Date(this.filterSinceDate).getTime() + idxs[0]); const tuntil = window.getDateStr(new Date(this.filterSinceDate).getTime() + idxs[1]);