Gantt data loaded via XML displays wrong dates

Hi,

I’m dynamically creating a XML file which I forward to the dhtmlxGantt chart API:

<projects> <project id="1" name="lalala" startdate="2012,08,20"> <task id="1"> <name>Start</name> <est>2012,08,26</est> <duration>32</duration> <percentcompleted>100</percentcompleted> <predecessortasks></predecessortasks> </task> <task id="2"> <name>Test</name> <est>2012,08,24</est> <duration>32</duration> <percentcompleted>100</percentcompleted> <predecessortasks></predecessortasks> </task> <task id="3"> <name>Blurb</name> <est>2012,08,28</est> <duration>32</duration> <percentcompleted>100</percentcompleted> <predecessortasks>2</predecessortasks> </task> </project> </projects>

I’m aware that JavaScripts Date() implementation uses weird indexing for months. However, I think that’s not too relevant since in my problem year AND month are wrongly displayed when rendering. For the record, I convert my dates from

  1. 28-08-2012 to
  2. Tue Aug 28 00:08:00 CEST 2012 (GWT Date) to
  3. 2012,08,28 as described in the dhtmlxGantt API

I get the following result:


As you can see, the date line is totally wrong compared to the dates specified in my XML-file.
I create my chart with the following method (its Java code with Inline Javascript using JSNI):

[code]public static native JavaScriptObject initGantt(String xml) /*-{
var gantt = new $wnd.GanttChart();
gantt.setImagePath(“resources/dhtmlxGantt/imgs/”);
gantt.showNewProject(false);
gantt.setEditable(false);
gantt.create(“GanttDiv”);

	if(xml != "") {
		gantt.loadData(xml, false, false);
	}
	
	return gantt;
}-*/;[/code]

Also when I change all years from ‘2012’ to ‘2013’ in the XML-file it displays it in December 2012 in the chart. So seems like I have to substract the year as well? Still, how does dhtmlxGantt come from the months date “08” to December?

What if You change Your XML moving ALL the tasks on July (and NOT in August) ?

I suspect there’s a big mess on parseInt functions… If not specified they convert in base 8, not in base 10…

I’d like to hear a comment on it from DHTMLX guys…

Regards
FabioG

Hi, please remove leading null “0” from any numbers.