Proper dates are not not getting reflected-

Hi Team,


When I am trying to update the planned start date and end date, it is gfetting changed automatically and showing some random datas.

I am using the below code to update
where Planned Start Date & End dates are coming from the list.

//Adding Start Date to the TASK.
if (taskItem.PlannedStartDt != null)
Task.Set(Tsk.Start, (DateTime)taskItem.PlannedStartDt);

//Adding Finish Date to the TASK.
if (taskItem.PlannedEndDt != null)
Task.Set(Tsk.Finish, (DateTime)taskItem.PlannedEndDt);

Please let me know How to fix this Issue.


Thanks
Abhishek Prasad

Hi Abhishek,


Thank you for writing to Aspose Support team.

While working with Task’s dates in MSP, if you set the Finish date, MSP applies Finish No Later than constraint on the task. This can be achieved the same way using Task Constraints by Aspose.Tasks API. Alternatively, you can calculate the duration of a task by getting working hours between dates and set the task’s Start Time and Duration to achieve desired results. Please try any one of these to achieve you desired results and let us know if you face any issue.