From 66154ac233a48195184447620fb4d78cff538274 Mon Sep 17 00:00:00 2001 From: Alexander Klein Date: Tue, 16 Feb 2021 12:47:02 +0100 Subject: [PATCH] feature(components): prop-type DateFilter --- components/common/DateFilter.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/components/common/DateFilter.js b/components/common/DateFilter.js index fb76a081..6279d338 100644 --- a/components/common/DateFilter.js +++ b/components/common/DateFilter.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { endOfYear, isSameDay } from 'date-fns'; import Modal from './Modal'; @@ -54,7 +55,7 @@ const filterOptions = [ }, ]; -export default function DateFilter({ value, startDate, endDate, onChange, className }) { +function DateFilter({ value, startDate, endDate, onChange, className }) { const [showPicker, setShowPicker] = useState(false); const displayValue = value === 'custom' ? ( @@ -117,3 +118,13 @@ const CustomRange = ({ startDate, endDate, onClick }) => { ); }; + +DateFilter.propTypes = { + value: PropTypes.string, + startDate: PropTypes.instanceOf(Date), + endDate: PropTypes.instanceOf(Date), + onChange: PropTypes.func, + className: PropTypes.string, +}; + +export default DateFilter;