diff --git a/components/common/DateFilter.js b/components/common/DateFilter.js index ba3417d1..d6888f2f 100644 --- a/components/common/DateFilter.js +++ b/components/common/DateFilter.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; +import { useSelector } from 'react-redux'; import { FormattedMessage } from 'react-intl'; import { endOfYear, isSameDay } from 'date-fns'; import Modal from './Modal'; @@ -47,6 +48,11 @@ const filterOptions = [ value: '90day', }, { label: , value: '1year' }, + { + label: , + value: 'all', + divider: true, + }, { label: , value: 'custom', @@ -54,9 +60,10 @@ const filterOptions = [ }, ]; -function DateFilter({ value, startDate, endDate, onChange, className }) { +function DateFilter({ value, startDate, endDate, onChange, className, websiteId = null }) { const { locale } = useLocale(); const [showPicker, setShowPicker] = useState(false); + const createdAt = useSelector(state => state.websites[websiteId]?.createdAt); const displayValue = value === 'custom' ? ( handleChange('custom')} /> @@ -69,7 +76,7 @@ function DateFilter({ value, startDate, endDate, onChange, className }) { setShowPicker(true); return; } - onChange(getDateRange(value, locale)); + onChange(getDateRange(value, locale, createdAt)); } function handlePickerChange(value) {