dhtmlxGantt TypeError: el is undefined

Am trying to change start date and end date automatically in gantt chart
as following
var date_start = new Date();
gantt.config.start_date = new Date(date_start.getFullYear(), date_start.getMonth(), date_start.getDate(), 00, 59);
gantt.config.end_date = new Date(date_start.getFullYear(), date_start.getMonth(), date_start.getDate(), 23, 59);
gantt.render();

but got the following error
TypeError: el is undefined
var left = Math.max(el.offsetLeft - this.config.task_scroll_offset, 0);

need help,
thank you in advance

Hello,
this seems to be happening when gantt tries to display data from outside of the visible time span. We’ll fix the issue.
for now you may filter-out such tasks manually:gantt.attachEvent("onBeforeTaskDisplay", function(id, task){ if (task.start_date.valueOf() > gantt.config.end_date.valueOf() || task.end_date.valueOf() < gantt.config.start_date.valueOf() ){ return false; } return true; });

thank you