Our state of the art Gantt chart


Post by capmo »

Hello there!

We have a problem with the start/end date relationship. The same can be confirmed in the example project. https://www.bryntum.com/examples/gantt/advanced/
Image

The start date is Jan 14, 2019, and the end date is Jan 16, 2019, and the duration is only 2. Why it is not 3 days? Jan. 14, 15, 16?

Acceptance criteria:
Task end date timestamp should always end on the last working day

a day used in task start and end date always starts at 00:00:00 and ends at 23:59:59

Task with duration = 1 starts and ends on the same day ("task takes 1 day")

Task with duration =2 ("task takes 2 days")

start = n

end = n+1

Find an example here:

Image

How can we achieve this?


Post by arcady »

Date object does not work the way you expect 23:59:59 minus 00:00:00 equals 23 hours 59 minutes 59 seconds ..but not 24 hours. It would loose a second every time..
End date value is just not inclusive (it's just a point on the time axis) so a task having 2021-05-05 00:00:00 end date finishes at the end of 4th of May.

Try using 8hrs a day calendar to see the dates you expect. You can try that on the advanced demo for example - open the demo and execute this code in your browser console:

gantt.project.hoursPerDay = 8
gantt.project.calendar = 'business'

Post by capmo »

Hello @arcady!

Let's say we have a task like this.

[
    {
        "id": "e5ab3198-7db2-11eb-97fa-7bf721932231",
        "name": "2 days",
        "percentDone": 0,
        "parentIndex": 0,
        "parentId": null,
        "companyId": null,
        "responsibleId": null,
        "__typename": "Task",
        "constraintDate": "2019-09-05T00:00:00.0000+02:00",
        "startDate": "2019-09-05T00:00:00.0000+02:00",
        "endDate": "2019-09-06T23:59:59.0000+02:00",
        "taskNumber": 50,
        "manuallyScheduled": false,
        "constraintType": "startnoearlierthan"
    }
]

At first, things look good.

Image

But when one clicks on the duration cell it looks like this.

Image

From a Javascript perspective this makes sense, but is there some Bryntum mechanism to fix this?

What your proposal would be to organize data/config in such a way that (for example) 2019-09-05 and 2019-09-06 dates have a duration of 2 days, and that they are shown in the scheduler as in the first picture, and that we can use the duration cell as a whole number.


Post by arcady »

We don't have any configs to show duration of 59 seconds as 1 minute I'm afraid.

But you can try overriding our code to implement any logic you need:

1) Would usage of 8 hrs/day calendar work for you if task bars filled the whole day ticks?
Then I would try overriding tasks rendering to fill ticks. We have a feature request for this IIRC.

2) on UI level you can provide a custom renderer to show end date minus 1 day for example. Then you need to override https://bryntum.com/docs/gantt/#SchedulerPro/widget/EndDateField to display date properly. Or apply this approach to corresponding duration column & field.

3) implement custom ways of calculating task start/end/duration on the data level. Calculation of duration is performed by calculateProjectedDuration method. You can find its implementation in lib/Engine/quark/model/scheduler_basic/BaseEventMixin.ts and lib/Engine/quark/model/scheduler_pro/SchedulerProHasAssignmentsMixin.ts files. You will also need to override calculateProjectedXDateWithDuration method of BaseEventMixin class to calculate start/end by duration consistently.


Post Reply