Getting a duration or start/end dates that acknowledge non working days
Hi,
The Gantt Chart is able to place the taskbars such that they don't land on the weekend/holidays and the duration is such that it doesn't acknowledge non-working days. Is is possible to make use of whatever function is called so that we can predict how a taskbar will be placed or to calculate durations that aren't associated with a task?
Thanks.
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
PP
Pooja Priya Krishna Moorthy
Syncfusion Team
March 25, 2021 12:39 PM UTC
Hi Samantha,
We are sorry that we are not able to get your requirement properly.
Do you want to render tasks with dates given in the data source.(i.e.) weekends/ holidays should also be taken into account while validating dates.
If yes, please refer the below documentation link.
Documentation - https://ej2.syncfusion.com/vue/documentation/gantt/task-scheduling/#manually-scheduled-tasks
If this is not your requirement, please explain it in detailed manner. It will be also very helpful, to understand your requirement if you share us with a pictorial representation.
Regards,
Pooja K.
SE
Sean
March 25, 2021 01:53 PM UTC
Hi Pooja,
No problem at all. Let me rephrase this question.
Is there any internal SyncFusion methods/code available to us so that we could pass something like start and end date to it, and it would return the duration of these 2 dates?
As you are aware, the gantt chart has Holidays and Weekends built in to it. So we are looking for a method that does this calculation for us if we supply two dates to it ?
PP
Pooja Priya Krishna Moorthy
Syncfusion Team
March 26, 2021 01:08 PM UTC
Hi Samantha,
In Gantt, duration is calculated based on weekend, holidays, dayWorkingTime. There is no internal methods, to calculate exact duration between two dates without these validations.
We can find the duration between two dates as like below code example.
|
var sDate = new Date("01/01/2021");
var eDate = new Date("01/05/2021");
var diff = eDate.getTime() - sDate.getTime();
var duration = diff / (1000 * 3600);
|
Regards,
Pooja K.
SE
Sean
March 29, 2021 11:09 AM UTC
Hi Pooja,
Do you have a code example that calculates duration between two dates that takes weekend, holidays, dayWorkingTime into consideration ?
Thanks
PP
Pooja Priya Krishna Moorthy
Syncfusion Team
March 30, 2021 10:16 AM UTC
Hi Samantha,
Yes, it is possible to calculate duration, by taking weekends, holidays into considerations. We can get the duration by using getDuration method as like below code example.
|
<button onclick="getDuration()">Get Duration</button>
<script>
function getDuration() {
var obj = document.getElementById("Gantt").ej2_instances[0];
var duration = obj.dataOperation.getDuration(
new Date("03/01/2021"), new Date("03/08/2021"), "day", true, false, true);
} |
Please refer the below code snippet to know about the parameters to be passed in getDuration method.
|
getDuration( startDate: Date, endDate: Date, durationUnit: string, isAutoSchedule: boolean,
isMilestone: boolean, isCheckTimeZone?: boolean)
|
Details:
startDate & endDate – must be date format as shown above.
durationUnit - to specify the duration as day, hour or minute.
isAutoSchedule - Duration calculation must be auto validated or not based on weekends.
isMilestone - To determine whether duration is calculated for milestone or child task.
isCheckTimeZone - Whether to get duration based on time zone.
Please get back to us if you need more detail on this.
Regards,
Pooja K
Marked as answer
SIGN IN To post a reply.