Set Due Date by Skipping Weekdays and Business Holidays (Custom Schedule)
Fidel,
I am excited about the new feature that allows us to create a Custom Schedule. I am interested in how I can use this along with the addDaysSkippingWeekends to accomplish setting the due date to skip weekdays and business holidays (as defined in a Custom Schedule). I tried this but it doesn't work as I expected.
Custom Schedule
#2018 Thanksgiving
2017/11/23 - 2017/11/24 {;}
#Annual Holidays
JAN/1, JUL/4, DEC/25 {;}
Can you kindly advise?
Thanks, Jeff
Comments (5)
-
repo owner -
reporter Thank you for the very prompt reply. I implemented the changes as suggested, however, when I pick a Date Discovered of July 3rd, the Due Date is resulting in July 4th.
Here are screenshots of my configuration;
-
repo owner It seems that there is little bug with whole day intervals. I will fix in next version.
Anyway, there is a very simple workaround: simply add 1 day and 1 millisecond. Use the following formula:
addTime({nnnnn}, 1 * {DAY} + 1, "Annual Holidays", LOCAL)
-
reporter The workaround works perfectly! Thanks again for the prompt responses!!!
-
repo owner - changed status to resolved
Hi @jebteb,
The cause of your problem is not actually a bug, but normal behavior of
addTime()
in certain cases: when you add the exact time duration that fills up a time interval, the value returned is the upper time limit of the time interval. In SDG the upper limit of a time interval is considered out of schedule.If you want to ensure that the value returned by
addTime()
is always in schedule, you should apply the value returned to functionnextTime()
. This function, when applied to a time instant which doesn't belong to a schedule, returns the closer time in the future that belongs to the schedule.For your particular case you should use the following expression:
nextTime(addTime({nnnnn}, 1 * {DAY}, "Annual Holidays", LOCAL), "Annual Holidays")
Function
nextTime()
has been included in JWT in version 2.2.40. - Log in to comment
Hi @jebteb,
Use the following schedule definition:
And use the following formula in "Mathematical and date-time expression calculator" post-function for setting Due date:
replacing nnnnn with field code for Date Discovered custom field.