mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
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:
parent
ff1c603585
commit
d0763531f5
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user