BUG: getFullYear

deadline is one field of gantt.config.columns ,after I click “+” to add task,it work wrong.

error:
VM3246:3 Uncaught TypeError: Cannot read property ‘getFullYear’ of undefined
at eval (eval at date_to_str (dhtmlxgantt611.js:11), :3:16)
at dhtmlxgantt611.js:11
at Object.gantt.templates.tooltip_text (custom.js:345)

error source code:
var deadline = formatFunc(task.deadline);

the whole code:

gantt.templates.tooltip_text = function(start,end,task){

var result = "";

var holders = task.holders;

if (!holders || !holders.length) {
	result = "Unassigned";
} else if(holders.length == 1){
	result = findUser(holders[0]).label;
} else {
	
	holders.forEach(function(holderId) {
		var holder = findUser(holderId);
		if (!holder)
			return;
		result +=  holder.label ;

	});	
}
var formatFunc = gantt.date.date_to_str("%Y-%n-%j");

var deadline = formatFunc(task.deadline);

return  task.text + formatFunc(start) + "-" + deadline ;

};

Hello,
That error is not a bug, it is related to the configuration.
First, you need to check that a task has the deadline date:

if (task.deadline) {
  var deadline = formatFunc(task.deadline);
  return  task.text + formatFunc(start) + "-" + deadline ;
}
else return '';

Then, if the task really has the deadline property, you need to make sure that there is the date object, not just a string with the date. You can do that by parsing the date when loading a task so that it can be used in other functions like additional layers:

gantt.attachEvent("onTaskLoading", function (task) {
	task.deadline = gantt.date.parseDate(task.deadline, "xml_date");
	return true;
});

Or you can parse the date only in the tooltip_text template:

if (task.deadline) {
  var deadline = gantt.date.parseDate(task.deadline, "xml_date");
  return  task.text + formatFunc(start) + "-" + deadline ;
}
else return '';

Here are the snippets:
http://snippet.dhtmlx.com/969beeb8e
http://snippet.dhtmlx.com/8e43858a7