We use AG Grid and I can see that in the date filter we have 'This Week', 'This Quarter', 'This Month', 'This Year' etc. But our year is a business year that runs from April to March. How can I add that option to the filter?
Based on the date filters that you list, I am fairly sure that you are using AdapTable - our AG Grid add-on. If so, then you simply need to add a Custom Predicate in the AdapTableQLOptions section of AdapTable Options and make it available for all Date column filters. Based on your question something like this should do the trick:
adaptableQLOptions: {
customPredicateDefs: [
{
id: 'business_year',
moduleScope: ['filter'],
columnScope: {
DataTypes: ['Date']
},
label: 'Business Year',
handler: ({ value, inputs }) => {
const businessYearStart: Date = new Date(2022, 3, 1);
const businessYeaEnd: Date = new Date(2023, 2, 31);
return value >= businessYearStart && value <= businessYeaEnd;
},
},
],
}
This will make that filter appear in Quick Filter bar dropdown for all Column Filters. See more at: https://docs.adaptabletools.com/guide/adaptable-ql-predicate-custom