Hi All,Scenario 1Assume the Start Date 30/4/2021 and Working Days to add is 4, which the outcome End Date will be 6/5/2021.
Scenario 2Assume the Start Date 30/4/2021 and Working Day is -4, but 29/4/2021 is a public holiday, and the outcome End Date should be 26/4/2021? (Not sure if I am correct for this calculation, please correct me if I am wrong.)
I've tried several solutions but I couldn't get the expected outcome.
The nearest outcome I could get is from this solution.https://stackoverflow.com/questions/33942544/how-to-skip-weekends-while-adding-days-to-localdate-in-java-8/33943576
But there is a bug in the result which I couldn't understand and not able to resolve.
Taking the scenario 1 as example, I input 4 work days, by right should get 6/5/2021, but I will always get 7/5/2021. It should move 6 calendar days instead of 7. I had tried to calculate manually by following the formula in attached image, also getting 7. The weird thing is when I add work day 1-3, it works well, only when Thursday, it calculate incorrectly.
Attached is my oml. You can find it in SampleWorkDayCalc Web Screen's On Change action.
Appreciate your helps!
Hi Gwen,
I would do the following:
In the end, the counter will have the number of days between start and end date excluding weekends and holidays.
From a performance standpoint, you actually just do one call to the database / external service to get the holidays, the rest is all logic which runs in the server.
Kind Regards,João