dHTMLxGantt: Red alert box"Invalid Day Index"

Hello Guys!!

I have a special demo data-structure for my gantt…

i have 3 levels.
0-> Groups
1-> Users
2-> Tasks

If a task has type(custom field) group i allow to expand/collapse the tree(display icon). If it’s a user or a task i dont allow to expand/collapse(display:none).

i display the task in an users-row with addTaskLayer. So there are only groups and users displayed in the grid… and in the timeline in the users-row you see all the tasks of a user in 1 row.

works fine so far.

I want to close all trees initially with config.openTreesInitially(false);

But when i do this i get “invalid day index” error… like 5 times in a row. and it adds more of this errors when i expand the trees for the first time…

When i set config.openTreesInitially(true); i get no errors… but every tree is openend, which i dont want since the tasks should only be displayed in the users-row.

All my data have a start_date, i checked this twice.

Does anyone have a clue what could cause this problem?



You have a custom functionality and seems it causes the issue.
We need to have the opportunity to reproduce it to understand how can we help you. Please create a demo of the problem here docs.dhtmlx.com/gantt/snippet/

Nevermind, we just took away the alert from the gantt-files, because there was no issue except for the alert box itself. :unamused:

Hi @fr0sty, I’m also having the same issue as you, where do you remove the alert function from the gantt-files? thanks

Same problem with me. How to take away the alert box? Pls share. Thanks

The red error box usually indicates that something in the code works not in an expected way and causes the issue.
So, firstly I’d suggest tracking the original issue which causes the red box:

You can add this code, open the debugger in the browser and try to reproduce the error:
gantt.attachEvent(“onError”, function(errorMessage){
return true;

It should stop the code execution right before the box appears and you’ll be able to see the stack trace and figure what code triggers the error box. This article explains more about debugging in the developer tools:
developers.google.com/web/tools … reakpoints

You can disable red boxes using this config:
gantt.config.show_errors = false;

It’ll make sense when you deploy the app to the end users, but during the development, I strongly suggest to investigate these issues. Otherwise, you may end up masking the bugs which will make the code working not predictably and not as intended.

Related docs:
docs.dhtmlx.com/gantt/api__gant … onfig.html
docs.dhtmlx.com/gantt/api__gant … event.html
docs.dhtmlx.com/gantt/faq.html# … ttopcorner

I was getting this error - the problem was that my date format was getting changed from “DD/MM/YYYY” (expected) to “MM/DD/YYYY” (invalid) before the date was coming into my app - thus ‘invalid day index’ was referring to incorrectly formatted dates that DHTMLXGantt couldn’t read.