Our state of the art Gantt chart


Post by daniel.piret »

Hello,

I need your help again with the dates as I'm having different combination of problems, I'm using the version 4.0.2 with the attached json:

  1. Research 1 task is flagged as manual and scheduling Normal and the end dates gets recalculated from 16/feb to 15/feb for no reason, if it's manually scheduled and Normal the dates should not change right?
  2. Research 2: Changing the calendar from business to general turns the duration to 12 days with the same dates, this is not based on effort so why the duration gets calculated as 12 days if it's only 5 days?
  3. Research 3: Using the business calendar but putting the start on 8am and end 17 (which matches the business calendar) gets the duration calculated as 4.9, but it's using the full business day, so why is not getting calculated to full day?
  4. Meeting 1 is using start date and end date with the same date and gets it flagged as milestone, 0 duration, which make sense as it's 0 hours... so in order to do a 1 day task I've changed to...
  5. Meeting 2: start on 8am and ends on 17, which is a full day work based on the business calendar, but the duration is now 0.8 days (I think it's the same as the item 3)

The above are happening after changing the project calendar to business as suggested here: viewtopic.php?f=52&t=15717 if I change the project calendar back to general then the errors are similar to the other post we have created

We are welcome to suggestions as our project is getting delayed quite heavily,

Thanks,

Attachments
bug384.json
(3.71 KiB) Downloaded 86 times

Post by arcady »

What's your local timezone? I'm asking since you provide dates in GMT timezone in your dataset:

"startDate": "2018-02-12T00:00:00Z",

Which means the dates get adjusted to local timezone when loading into browser. So knowing your timezone (GMT shift) is needed to get the same results.

Please note that while testing the provided dataset I removed trailing "Z" to avoid that local timezone adjustment. To get dates as-is.

Research 1 task is flagged as manual and scheduling Normal and the end dates gets recalculated from 16/feb to 15/feb for no reason, if it's manually scheduled and Normal the dates should not change right?

"Research 1" task start/end dates are set according to the task calendar startDate "2018-02-12T00:00:00Z" is adjusted to "2018-02-12T08:00", and endDate "2018-02-16T00:00:00Z" is adjusted to "2018-02-15T17:00".
It works the same way in Ext Gantt too as far as I see.

Research 2: Changing the calendar from business to general turns the duration to 12 days with the same dates, this is not based on effort so why the duration gets calculated as 12 days if it's only 5 days?

Changing of what calendar? The task one? I don't see that I see that in the provided dataset the task has 4 days duration. When I set the task calendar in the dataset to "business" duration is calculated as 1.3 days ("business" calendar allows it to work for 8h a day. So startDate "2018-02-12T00:00:00Z" and endDate "2018-02-16T00:00:00Z" gives us 4*8=32 hours. Which is 32/24=1.333(3) days since the project hoursPerDay is 24). It's explained in this guide.

Research 3: Using the business calendar but putting the start on 8am and end 17 (which matches the business calendar) gets the duration calculated as 4.9, but it's using the full business day, so why is not getting calculated to full day?

I cannot reproduce that.. for me duration is 1.7 days (startDate "2018-02-12T08:00:00" endDate "2018-02-16T17:00:00" which gives 5*8=40hrs, 40/24=1.666(6)=1.7 days.

Not sure if that makes sense to continue checking given that I see different results..

Meeting 2: start on 8am and ends on 17, which is a full day work based on the business calendar, but the duration is now 0.8 days (I think it's the same as the item 3)

For me duration is 0.3 days. Duration is 8 hours which in "days" is: 8/24=0.333(3) days


Post by daniel.piret »

Is there a way to calculate the duration based on full days using the calendar for holidays and weekends? what I'm planning to do is to have new "duration" (DurationX) in the task model that returns the difference in days based on the calendar, but it will help me a lot of you already have a function for this, so far I'm testing it with this:

const calendar = this.effectiveCalendar; 
var duration = project.$convertDuration(calendar.calculateDurationMs(startDate, endDate), TimeUnit.Millisecond, TimeUnit.Day);

But the result is a "generator", I'm not sure how to get the magnitude of the duration from it,

Thanks


Post by arcady »

Yes $convertDuration method is a generator that relies on the project graph state.
You can call such methods this way:

const result = project.run('$convertDuration', duration, fromUnit, toUnit)

But the method is private ..instead you can use public convertDuration method:

const result = project.convertDuration(duration, fromUnit, toUnit)

Post by daniel.piret »

Thanks for the quick reply, what about the calendar? because I think the one that has the trick to calculate the duration removing the non-working days is in the calendar logic, right?

Is it ok to call calendar.calculateDurationMs(startDate, endDate)?

Thanks


Post by arcady »

Yes calendars are responsible for taking non-working time into account.

A 24h/day calendar data having non-working Saturday and Sunday might look like this:

{
    "id": "general",
    "name": "General",
    "intervals": [{
        "recurrentStartDate": "on Sat at 0:00",
        "recurrentEndDate": "on Mon at 0:00",
        "isWorking": false
    }]
}

Is it ok to call calendar.calculateDurationMs(startDate, endDate)?

Yes it's perfectly fine the method is public.


Post Reply