Problem with parsing end_date from an XML file (Version 2.0)

Hi There,

I installed and configuared the new dhtmlxGantt control and I am initializing it with an XML file using the gantt.parse(data, “xml”) command.
The problem is that the gantt displays a different end_date than the one that is specified in the XML.
The XML that I am using is the following:

<?xml version="1.0" encoding="utf-16"?> <data> <task id="root" parent="" open="true" start_date="3-12-2012" duration="6039.9833333333327" progress="0" end_date="12-8-2013"><![CDATA[Templates]]><status><![CDATA[All]]></status><template>Templates</template></task> <task id="114766" parent="root" start_date="3-12-2012" duration="264" progress="0" end_date="14-12-2012"><![CDATA[Site Walk]]><status><![CDATA[Completed]]></status><template><![CDATA[Site Walk]]></template></task> <task id="141585" parent="root" start_date="9-1-2013" duration="509.35883805555551" progress="0" end_date="31-1-2013"><![CDATA[Site Walk]]><status><![CDATA[NotStarted]]></status><template><![CDATA[Site Walk]]></template></task> <task id="158668" parent="root" start_date="1-3-2013" duration="1272" progress="0" end_date="23-4-2013"><![CDATA[site walk]]><status><![CDATA[NotStarted]]></status><template><![CDATA[Site Walk]]></template></task> <task id="127142" parent="root" start_date="19-12-2012" duration="624.5838575" progress="0" end_date="15-1-2013"><![CDATA[RL Field - BMI]]><status><![CDATA[NotStarted]]></status><template><![CDATA[RL Field]]></template></task> </data>

You can see that task 114766 has an end date of 14-12-2012, but the end date on the chart is 24-8-2013.
the XML end date for task 158668 is 23-4-2013 but the chart displays an end date of 24-8-2016!

Did anyone encountered the same problem? Am I doing something wrong?

Thanks in advance,

Shai.

Add the next line before gantt initialization

gantt.config.xml_date = "%d-%m-%Y";

It will specify format of date strings in XML and must resolve the issue.

I added your line of code before the initalization command, but I am still having the same problem…

We can confirm the issue.
When you are providing both end_date and duration - the gantt will use duration to calculate end_date instead of using the value of end_date attribute

You can rename duration attribute in xml to something like myduration. In such case gantt will use end_date for tasks’s length, and you will be able to use myduration in the grid

(In next update we will change behavior. If both duration and end_date are provided - end_date will have priority over duration )

Thanks! that solved my problem.

Shai.