а

Date range is not working when export to pdf


#1

Hi ,

I am exporting gantt chart in pdf.
i am trying to set sart and end date, but its not working.
i tried to set gantt.config.start_date and gantt.config.end_date but still its not taking.

public generateReport() {

    gantt.config.start_date = this.startDate;
    gantt.config.end_date = this.endDate;

   gantt.exportToPDF({
        name: 'GanttReport-' + this.projectID + '.pdf',
        raw: true
    });
};

#2

Hello Sweeti,
We know about that bug. When you use the raw: true parameter, the specified date range in the export function is not applied. The dev team will fix the bug in the future, but I cannot give you an ETA.
As a workaround, you need to set the date range, export the data, and revert the date range:
http://snippet.dhtmlx.com/10efec83e
You need to check the this.startDate and this.endDate parameters, they should contain the correct date objects. You can use the gantt.copy() function to copy the date object or use the new Date() function to create a new date object.

If that doesn’t help you, please, reproduce the issue in the snippet, then click on the “Share” button and send me the link.