Fix custom date range display. Closes #923, #921

This commit is contained in:
Mike Cao 2022-01-20 19:54:58 -08:00
parent 2baf4b19fe
commit 547eefae82
4 changed files with 17 additions and 8 deletions

View file

@ -10,7 +10,7 @@ import { dateFormat } from 'lib/date';
import Calendar from 'assets/calendar-alt.svg';
import Icon from './Icon';
const filterOptions = [
export const filterOptions = [
{ label: <FormattedMessage id="label.today" defaultMessage="Today" />, value: '1day' },
{
label: (
@ -59,7 +59,7 @@ const filterOptions = [
},
];
function DateFilter({ value, startDate, endDate, onChange, className }) {
function DateFilter({ value, startDate, endDate, onChange, className, options }) {
const [showPicker, setShowPicker] = useState(false);
const displayValue =
value === 'custom' ? (
@ -86,7 +86,7 @@ function DateFilter({ value, startDate, endDate, onChange, className }) {
<DropDown
className={className}
value={displayValue}
options={filterOptions}
options={options || filterOptions}
onChange={handleChange}
/>
{showPicker && (