From abec44a1cbe63a938a836d1e2ea2ad061e19cb3c Mon Sep 17 00:00:00 2001 From: Steve Tsala <45661418+SteveGT96@users.noreply.github.com> Date: Thu, 28 Nov 2024 17:05:01 +0100 Subject: [PATCH] fix(OH2-439): Fix dashboard filter date range (#702) Co-authored-by: SteveGT96 --- .../filter/usePeriodOptions.ts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/accessories/dashboard/dashboardContent/filter/usePeriodOptions.ts b/src/components/accessories/dashboard/dashboardContent/filter/usePeriodOptions.ts index cd3213cc9..b39bb2808 100644 --- a/src/components/accessories/dashboard/dashboardContent/filter/usePeriodOptions.ts +++ b/src/components/accessories/dashboard/dashboardContent/filter/usePeriodOptions.ts @@ -22,30 +22,30 @@ export const usePeriodOptions = () => { if (view !== "range") { switch (selection) { case "current": - value = [moment().utc().startOf(view), moment().utc().endOf(view)]; + value = [moment().startOf(view), moment().endOf(view)]; break; case "previous": value = [ - moment().add(-1, view).utc().startOf(view), - moment().add(-1, view).utc().endOf(view), + moment().add(-1, view).startOf(view), + moment().add(-1, view).endOf(view), ]; break; case "last2": value = [ - moment().add(-2, view).utc().startOf(view), - moment().add(-1, view).utc().endOf(view), + moment().add(-2, view).startOf(view), + moment().add(-1, view).endOf(view), ]; break; case "last3": value = [ - moment().add(-3, view).utc().startOf(view), - moment().add(-1, view).utc().endOf(view), + moment().add(-3, view).startOf(view), + moment().add(-1, view).endOf(view), ]; break; default: value = [ - moment(dateRange[0]?.toISOString()).utc().startOf("day"), - moment(dateRange[1]?.toISOString()).utc().endOf("day"), + moment(dateRange[0]?.toISOString()).startOf("day"), + moment(dateRange[1]?.toISOString()).endOf("day"), ]; } if (view === "week") { @@ -53,8 +53,8 @@ export const usePeriodOptions = () => { } } else { value = [ - moment(dateRange[0]?.toISOString()).utc().startOf("day"), - moment(dateRange[1]?.toISOString()).utc().endOf("day"), + moment(dateRange[0]?.toISOString()).startOf("day"), + moment(dateRange[1]?.toISOString()).endOf("day"), ]; } return [value[0].toISOString(), value[1].toISOString()];