diff --git a/CHANGELOG.md b/CHANGELOG.md index b097c7132..727aea175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Use `` and `stripes.hasAnyPerm` to check for Notes assign/unassign perm. Fixes STSMACOM-875. * Fetch updaters in `` on `props.metadata` changes. Fixes STSMACOM-878. * Use `this.resources` in `StripesConnectedSource` instead of accessing props directly. Fixes STSMACOM-879. +* `DateRangeFilter` - set the `wrongDatesOrder` to `false` when the field value changes. Fixes STSMACOM-880. ## [9.2.0](https://github.com/folio-org/stripes-smart-components/tree/v9.2.0) (2024-10-11) [Full Changelog](https://github.com/folio-org/stripes-smart-components/compare/v9.1.3...v9.2.0) diff --git a/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js b/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js index 2bdc97741..3954cb21c 100644 --- a/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js +++ b/lib/SearchAndSort/components/DateRangeFilter/DateRangeFilter.js @@ -169,6 +169,7 @@ const TheComponent = ({ ...filterValue, errors: { ...filterValue.errors, + wrongDatesOrder: false, // dates order is validated only when the "Apply" button is clicked, not when the field value is changed [errorName]: dateIsInvalid }, selectedValues: newSelectedValues diff --git a/lib/SearchAndSort/components/DateRangeFilter/tests/DateRangeFilter-test.js b/lib/SearchAndSort/components/DateRangeFilter/tests/DateRangeFilter-test.js index 7f44518db..f90c18cae 100644 --- a/lib/SearchAndSort/components/DateRangeFilter/tests/DateRangeFilter-test.js +++ b/lib/SearchAndSort/components/DateRangeFilter/tests/DateRangeFilter-test.js @@ -144,6 +144,15 @@ describe('DateRangeFilter', () => { it('should display corresponding error below the filter', () => ErrorInteractor('Start date is greater than end date').exists()); it('should not apply the filter', () => converge(() => { if (onChangeHandler.called) throw Error('expected onChangeHandler to not be called!'); })); + + describe('and then both dates were cleared', () => { + beforeEach(async () => { + await startPicker.fillIn(''); + await endPicker.fillIn(''); + }); + + it('should not display an error below the filter', () => ErrorInteractor('Start date is greater than end date').absent()); + }); }); describe('when date range is correct and "Apply" button was clicked', () => {