Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Calculating the number of working days between two given dates

Hi
I want to calculate dates difference between two randomly selected days (weekdays only).

Eg: Input – Leave Start Date and Leave end date

Output – Difference in week days (exclusive of weekend days)

Current script to calculate date difference in full:

getValue: function(attribute, workItem, configuration) {
var startDate = dojo.date.stamp.fromISOString(workItem.getValue("leaveStartDate"));
var endDate = dojo.date.stamp.fromISOString(workItem.getValue("leaveEndDate"));
var daysDifference = dojo.date.difference(startDate,endDate, "day");
   
return daysDifference;

}

Appreciate your help.

DK

0 votes

Comments

I believe you need a localized calendar for this function, which to my knowledge does not exist. For example, Christmas day is a non-working day in most Western countries, but remains a working day in most Asian countries.

1 vote

Thanks for the comment Donald and indeed it’s a valid point. Leaving the calendar function for further developments, do you have any idea how can we at least ignore the weekend from a day count.
Thanks - DK


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 2

Question asked: Dec 21 '17, 9:19 a.m.

Question was seen: 1,756 times

Last updated: Dec 28 '17, 6:27 a.m.

Confirmation Cancel Confirm