When using isBusinessDay OOTB function if we pass any Monday date and check whether it is a business day or not its returning false everytime. We are using our custimzed calendar and we have specified working hours from 8 am to 5 pm. We have specified only sunday and saturday as weekly holidays. We are passing date in the form yyyymmdd. My suspicion is that since we are not passing time it is taking the time as default (00000 hhmmss). But if my suspicion is true why is it happening only for monday. For all dates we are passing it in the form(yymmdd) but this particular issue happens only if we pass a monday date.
Edit(1/Dec/2016): The issue is resolved when we pass a dateTime value instead of date value.
***Updated by moderator: Lochan to add Categories***
It is working correctly for tuesday-sunday. Its not working only for monday.
I have been experimenting with the functions(addDays and isBusinessDay) for 2-3 days now. From what I can gather the functions are showing a weird behaviour if we pass date alone(i.e. just [yyyymmdd] without time). If we pass date alone sometimes monday is getting skipped for addDays and for isBusinessDay it is returning false while it should return true. I am geting around this issue by adding a arbitary working hour time with the date explicitly when passing the parameter. I am not really sure why this is happening.
For example Nov. 11 is a holiday in our Calendar.
When I use this function @(Pega-RULES:BusinessCalendar).addDays(date, -1, true, OurCalendar). If I pass tuesday's date (20161115) it is returning 20161111 which is weird because first it should return 20161114 but also the date it returned is a holiday according to our calendar.
If I add a arbitary time like "T130751.357 GMT" to the date and pass the parameter it is returning the correct answer.
This is also happening with isBusinessDay function.
If I pass the date alone for @(Pega-RULES:BusinessCalendar).isBusinessDay(Date, US_CST) it is returning false for any Monday date. But if we add a working hour time like "T130751.357 GMT" and then pass the date it is working correctly.
Posted: 5 years ago
Posted: 3 Nov 2016 9:41 EDT
Santanu Bhattacherjee (Santanu)
Senior Manager, Cloud Engineering, Management Plane Services
And you are right. This issue is happening only with date. If date time is passed it is working correctly. Also this same isssue happens with addDays also. You can check my detailed response for another person in this thread.