How does ‘startDate’, ‘constraintType’, ‘constraintDate’ work?

Our state of the art Gantt chart
Post Reply
User avatar
weilan
Posts: 8
Joined: Wed Aug 07, 2019 3:33 am

How does ‘startDate’, ‘constraintType’, ‘constraintDate’ work?

Post by weilan » Wed Aug 21, 2019 3:35 am

I want the start time of task to be arranged according to my own'Start Date', as long as the start time of'task'is not earlier than the start time of'project'. But when I set'constraintDate'as'startDate' for'project', the time for'task'to be displayed becomes'startDate' for'project'. If I set'constraintDate'to'startDate' of'task', the start time of'task'cannot be chosen earlier than that date, but can only be postponed. This makes it impossible for my clients to use it at all.
item.startDate = new Date (2019, 3, 25);
item.constraintType = "startnoearlierthan";
item.constraintDate = new Date(2019, 0, 1)
I hope the task starts with'item. startDate'and can be modified at will within the time range of'item. constraintDate'.
The problem now is that the start time of the task becomes `item. constraintDate'.
item.startDate = new Date (2019, 3, 25);
item.constraintType = "startnoearlierthan";
item.constraintDate = new Date(2019, 3, 25)
If I set `constraintDate'to be the same as `startDate', then task modification can never be earlier than this time. Once the user operates incorrectly, it can only delete all task reconstruction.

User avatar
pmiklashevich
Core Developer
Core Developer
Posts: 2242
Joined: Fri Apr 01, 2016 11:08 am

Re: How does ‘startDate’, ‘constraintType’, ‘constraintDate’ work?

Post by pmiklashevich » Tue Aug 27, 2019 7:44 pm

Hello,

startDate is a date when a task begins. Tasks can be manually scheduled or automatically. In case of manually mode, task begins at its start date, so having start date valid is important. When a task is NOT manually scheduled, its start date can be differ from what it's set to. It depends on parent-child relation, dependencies, constraints, etc. Tasks are scheduled "forward" starting from the project start date as soon as possible. But you can set "exceptions" to this rule. For that constraints are used. For example you have a project that starts on Monday. And a subtask that you want to start not earlier than Wednesday. But there is no incoming dependencies to this task, there is nothing that can move this task to Wednesday. In this case you can set constraintType to "startnoearlierthan" and constraintDate to the Wednesday. That's it. Project will be rescheduled but the subtask will start not earlier than Wednesday. No matter what startDate is set to, because it will be rescheduled according to its constraint. The same behaviour you can see if you drag a task to the right for example. Please pay attention to the Constraint Type and Constraint Date columns:
2019-08-27_2030.png
2019-08-27_2030.png (271.02 KiB) Viewed 45 times
Now back to your case, it's really hard to get what's wrong and what your goal is just base on the code snippets you provided. Could you please take one of our examples as a base, apply minimal changes to it to reproduce your issue, zip it up and attach here. Then please provide step-by-step instructions and your expectations about dates, calculation, etc on every step. Then we will have a context to help you with.

Best,
Pavel
Pavel Miklashevich - Core Developer

Post Reply