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 && (