I was able to follow a tutorial and add a search bar as a filter. https://dhtmlx.com/blog/filter-tasks-javascript-gantt-dhtmlx-video-tutorial/
Now, I would like to add a filter based on dates that the user will input. I added html to input the dates, I would like to grab the dates and used them to filter my gantt.
After that, you will be able to get their values, but to compare it with the task’s dates you should convert their format from the “string” to “date” format.
The gantt built-in solution to do it is the gantt.date.str_to_date(str) method, which converts a string to the date, this method expects string in the specific format, you can read about this by the following link: https://docs.dhtmlx.com/gantt/desktop__date_operations.html#convertingastringtoadateobject
After that, you will be able to compare the task’s date with the converted input’s value, like in this fragment:
function compare_input(id) {
var match = false;
if (gantt.getTask(id).start_date >= strToDate(start_filter_data) && gantt.getTask(id).end_date <= strToDate(end_filter_data))
match = true;
return match;
}