The TimeLine section on the right is misplaced


Why this problem and how to solve it ?

Hi @yyml,
Unfortunately, I can’t reproduce this issue in our snippet tool/locally, here is a demo:
https://snippet.dhtmlx.com/c9357011c
for now, I can’t suggest what could be the issue. Could you please reproduce it in the snippet above, click the share button and send me the link?

Sorry, I won’t use snippet tool to show my problem.
image

This is the main code and demo effect.

Hi @yyml,
Thank you for the screenshot and video. The “issue” that you have occurred is not a bug. It occurs because gantt places tasks in the chart, based on their dates(%dd-%mm-%yy %hh:%ii)
The “misplaced” data in your video has the format:
“Sat Jan 04-2020 08:00:00”
So the “misplaced” data shifted to right from the cell start, because they start not from the start of a day.

The “correct placed” data has the format: “Sat Jan 04-2020 00:00:00”.
Because they start at the start of the day, they placed on the start of the cell.

Here is a demo(click the reload button):
http://snippet.dhtmlx.com/acda97836

To solve it, you can store the data without hours, and forbid users to set the hours on task create/update operations.
By default, the time control in the lightbox doesn’t allow to set hours-minutes, so each created task will be created with “00:00:00” hour-minutes-seconds value, and placed at the start of the cell.

1 Like

You are right. The original reason is that when the parameter of new Date() is yyyy-mm-dd and the number of days is 0, 8 hours will be added automatically. When the format is yyyy/MM/dd, 8 hours will not be added automatically. Thanks for your explanation and answer.

1 Like