From cf1dd422fee79c08711be6c05030f3f36093012d Mon Sep 17 00:00:00 2001 From: Brian Cao Date: Fri, 25 Aug 2023 16:23:10 -0700 Subject: [PATCH] Disable filter on custom range. --- src/components/input/WebsiteDateFilter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/input/WebsiteDateFilter.js b/src/components/input/WebsiteDateFilter.js index a8403db6..6903a708 100644 --- a/src/components/input/WebsiteDateFilter.js +++ b/src/components/input/WebsiteDateFilter.js @@ -9,7 +9,9 @@ export function WebsiteDateFilter({ websiteId }) { const [dateRange, setDateRange] = useDateRange(websiteId); const { value, startDate, endDate, selectedUnit } = dateRange; const isFutureDate = - value !== 'all' && isAfter(incrementDateRange(dateRange, -1).startDate, new Date()); + value !== 'all' && + selectedUnit && + isAfter(incrementDateRange(dateRange, -1).startDate, new Date()); const handleChange = value => { setDateRange(value); @@ -21,7 +23,7 @@ export function WebsiteDateFilter({ websiteId }) { return ( - {value !== 'all' && ( + {value !== 'all' && selectedUnit && (