1
Vote

Subtract Business Days not working as expected when checking if only the last day is a business day

description

There appears to be a small issue with the Subtract Business Days workflow activity when only checking if the last day is a business day. The issue is that an unexpected number of business days is subtracted rather than the supplied number of days.

The issue is in Line 180 of DateUtilities.cs:
date = date.AddDays(((operation == Operations.Add) ? 1 : -1) * days - 1);
The code works as expected when adding business days, but when subtracting business days the number of days to subtract is incremented by 1 (via the final "days - 1").

Wrapping "days - 1" in parentheses fixes the issue:
date = date.AddDays(((operation == Operations.Add) ? 1 : -1) * (days - 1));

comments