a string from an XML file is converted into a date object in conformity with this template

dateDatethe date which needs formatting


gantt.templates.xml_date = function(date){
    return gantt.date.date_to_str(gantt.config.xml_date)(date);


The template is deprecated. Use parse_date instead:

const cfg = gantt.config;
const strToDate = gantt.date.str_to_date(cfg.date_format, cfg.server_utc);
gantt.templates.parse_date = function(date){
    return strToDate (date);

This template is automatically generated from the xml_date config and can be redefined after the initialization of gantt.

A custom template function can be used, if the format of server dates is not supported by the gantt date helper.

For example, using UNIX time for start_date:


        "text":"Task #1",
        "text":"Task #2",

You should set the Gantt configuration as follows:

gantt.attachEvent("onTemplatesReady", function(){
    gantt.templates.xml_date = function(dateString){
        return new Date(dateString * 1000);
See also
Change log

deprecated since v6.2, removed since v7.0

Back to top