Changed default date filter operator to "on or before"

no issue

- prevents automatically filtering out all of today's members as soon as a "Created" filter is added as happened when the default was "before"
This commit is contained in:
Kevin Ansfield 2022-03-03 19:14:33 +00:00
parent ff1c603585
commit d0763531f5
2 changed files with 9 additions and 3 deletions

View File

@ -482,11 +482,17 @@ export default class MembersFilter extends Component {
defaultValue = moment(moment.tz(this.settings.get('timezone')).format('YYYY-MM-DD')).toDate();
}
let defaultRelation = this.availableFilterRelationsOptions[newType][0].name;
if (newProp.valueType === 'date') {
defaultRelation = 'is-or-less';
}
const filterToEdit = this.filters.findBy('id', filterId);
if (filterToEdit) {
filterToEdit.type = newType;
filterToEdit.relationOptions = this.availableFilterRelationsOptions[newType];
filterToEdit.relation = filterToEdit.relationOptions[0].name;
filterToEdit.relation = defaultRelation;
filterToEdit.value = defaultValue;
}

View File

@ -653,8 +653,8 @@ describe('Acceptance: Members filtering', function () {
const valueDateInput = `${filterSelect} [data-test-input="members-filter-value"] [data-test-date-picker-input]`;
const valueDatePicker = `${filterSelect} [data-test-input="members-filter-value"]`;
// operator defaults to before
expect(find(operatorSelect)).to.have.value('is-less');
// operator defaults to "on or before"
expect(find(operatorSelect)).to.have.value('is-or-less');
// value defaults to today's date
expect(find(valueDateInput)).to.have.value('2022-03-01');