dan2
July 24, 2019, 1:52pm
#1
Hi,
I have my dates coming through from the database in a JSON API in the following format:
2020-10-07 00:00:00.000
However, they are being interpreted totally wrong. The above date is interpreted by the Gantt as
start_date: Fri Apr 11 1913 00:00:00 GMT+0000 (British Summer Time)
This seems to happen whether or not I am using the below.
gantt.config.date_format = “%d-%m-%Y”;
gantt.config.date_grid = “%d-%m-%Y”;
The date is retrieved in the correct format from the database however does not display correctly.
ramil
July 29, 2019, 8:44am
#2
Hello Dan,
You need to change the gantt.config.date_format. That property is used to specify the date format in the JSON data. To make it work correctly, with the 2020-10-07 00:00:00.000 date, you need to have the following date_format:
gantt.config.date_format = "%Y-%m-%d";
Suppose you have the following situation:
http://snippet.dhtmlx.com/f9b966fec
If you specify the date_format correctly, here is how it looks now:
http://snippet.dhtmlx.com/317d31fe8