I'm working on a BootstrapTable that has a single column with a dataField of birthday, where the date is formatted as "day/month" (e.g. "3/10" for October 3rd). I managed to create a formatter that changes each string like "3/10" to display as "October 3rd" in the table. Now, I want to add a textFilter and I'm currently using a default one. However, there's an issue - if the user types in "October", nothing shows up. You have to type in "10" for October 3rd to appear. I'm attempting to implement a custom filter so that typing in a substring like "Octo" will show all October birthdays and filter out non-October dates. How can I achieve this in my code below?
filterByPrice = (filterVal, data) => {
if (filterVal) {
var fields = data.birthday.split('/');
var month = parseInt(fields[1]);
var day = parseInt(fields[0]);
switch(month){
case 1:
month = "January";
break;
// other cases omitted for brevity
}
var dateString = month + " " + day;
data.filter(dateString.includes(filterVal));
}
return data;
const {columns} = {
columns: [{
dataField: 'birthday',
text: 'Birthday',
filter: textFilter({
onFilter: this.birthdayFilter
}),
formatter: birthdayFormatter,
}]
}