Business day and holiday calculator for a range of dates.

Matthew L.
edited February 11, 2022 in Analytics #1
This example contains custom JavaScript code that demonstrates how to calculate the number of business days that fall within a range of dates.<br />
<br />
The sample function "businessDaysCalculator()" within the report returns an object that contains various values about the given business days.<br />
<br />
For example:<br />
<br />
Array of holiday dates that fall within the date range:<br />
obj.holidaysInDateRange = Thu Jan 01 2015 00:00:00 GMT-0600 (CST),Mon Jan 19 2015 00:00:00 GMT-0600 (CST)<br />
<br />
Total number of business days that fall within the date range:<br />
obj.totalBusinessDays = 12<br />
<br />
Total number of days that fall within the date range:<br />
obj.totalDays = 20<br />
<br />
Total number of holidays that fall within the date range:<br />
obj.totalHolidays = 2<br />
...<br />
<br />
Additional holidays and floating dates can be added/removed within the code or function parameter for added flexibility.<br />
<br />
The attached example was created with BIRT Report Designer Professional 4.2.3 (iHub 3.0)
Warning No formatter is installed for the format ipb