From 9907d69d41ccf18bbd828bc50654b2e5983de6a0 Mon Sep 17 00:00:00 2001 From: Kai Rollmann Date: Tue, 6 Dec 2022 15:07:00 +0100 Subject: [PATCH 1/3] Fix history date range --> until today by default --- frontend/src/js/api/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/js/api/api.ts b/frontend/src/js/api/api.ts index 6a8ee25cc7..cc6a6c1f29 100644 --- a/frontend/src/js/api/api.ts +++ b/frontend/src/js/api/api.ts @@ -1,5 +1,6 @@ import { useCallback } from "react"; +import { formatStdDate } from "../common/helpers/dateHelper"; import { EntityId } from "../entity-history/reducer"; import { apiUrl } from "../environment"; import type { FormConfigT } from "../previous-queries/list/reducer"; @@ -398,7 +399,7 @@ export const useGetEntityHistory = () => { max: string; // Format like "2020-12-31" } = { min: "2015-01-01", - max: "2021-12-31", + max: formatStdDate(new Date()), }, ) => api({ From 03479aafe051fb69c0e6296f0d9f4cabbaa285e9 Mon Sep 17 00:00:00 2001 From: Kai Rollmann Date: Tue, 6 Dec 2022 17:04:03 +0100 Subject: [PATCH 2/3] Send no min by default --- frontend/src/js/api/api.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/js/api/api.ts b/frontend/src/js/api/api.ts index cc6a6c1f29..9f944d5b13 100644 --- a/frontend/src/js/api/api.ts +++ b/frontend/src/js/api/api.ts @@ -395,10 +395,9 @@ export const useGetEntityHistory = () => { entityId: EntityId, sources: HistorySources, time: { - min: string; // Format like "2020-01-01" + min?: string; // Format like "2020-01-01" max: string; // Format like "2020-12-31" } = { - min: "2015-01-01", max: formatStdDate(new Date()), }, ) => From 9fe06797c911b8472d8ccafd9791be4a3d424850 Mon Sep 17 00:00:00 2001 From: Kai Rollmann Date: Tue, 6 Dec 2022 17:11:29 +0100 Subject: [PATCH 3/3] Also make max optional --- frontend/src/js/api/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/js/api/api.ts b/frontend/src/js/api/api.ts index 9f944d5b13..f2b848e8d8 100644 --- a/frontend/src/js/api/api.ts +++ b/frontend/src/js/api/api.ts @@ -396,7 +396,7 @@ export const useGetEntityHistory = () => { sources: HistorySources, time: { min?: string; // Format like "2020-01-01" - max: string; // Format like "2020-12-31" + max?: string; // Format like "2020-12-31" } = { max: formatStdDate(new Date()), },