- {Array.from({ length: range === 'between' ? 2 : 1 }).map((input, index) => {
- const point = (index === 1 || range === 'before') ? 'end' : 'start';
+ {Array(range === 'between' ? 2 : 1).fill('').map((input, index) => {
+ const point = (index === 1 || range === 'before') ? 'End' : 'Start';
+ const id = `date-range-${point.toLowerCase()}-date`;
return (
-
+
{
- if (range !== 'between') {
- setSecondYear('');
- }
- return index === 1 ? setSecondYear(event.target.value) : setFirstYear(event.target.value);
+ return handleYearChange(index, event.target.value);
}}
autoComplete='on'
pattern='[0-9]{4}'
/>
- Please enter this format: YYYY
+ Please enter this format: YYYY
);
})}
@@ -107,9 +104,9 @@ const DateRangeInput = ({ currentFilters, datastoreUid, filterGroupUid }) => {
};
DateRangeInput.propTypes = {
- currentFilters: PropTypes.array,
- datastoreUid: PropTypes.string,
- filterGroupUid: PropTypes.string
+ currentFilter: PropTypes.string,
+ datastoreUid: PropTypes.string.isRequired,
+ filterGroupUid: PropTypes.string.isRequired
};
export default DateRangeInput;