Set Due Date by Skipping Weekdays and Business Holidays (Custom Schedule)

Issue #677 resolved
created an issue


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)

  1. jtabatabai 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;

    Custom Schedule.png


    Resulting Due Date.png

  2. Fidel Castro Armario 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)
  3. Fidel Castro Armario repo owner

    Hi @jtabatabai,

    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 function nextTime(). 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.

  4. Log in to comment