You need to sign in to do that
Don't have an account?
sp13
Business Days display
I was able to show Monday to Friday except sunday and saturday. My problem is when the checkbox field 'nightshift__c' is true, the table should only display Monday to Thursday.
here's my code:
public Date getdisplayingdates() { listOfDates.clear(); Date startDate = Date.ValueOf(leave.Leave_Date_From__c); Date endDate = Date.ValueOf(leave.Leave_Date_To__c); totaldays = startDate.daysBetween(endDate); boolean shift = leave.nighshift__c; if (shift == true) { for(integer i=0;i<=totaldays;i++) { Date today = startDate; Date startOfWeek = today.toStartOfWeek(); Integer dayOfWeek = today.day()-startOfWeek.day(); if(dayOfWeek == 0 || dayOfWeek == 6 || dayOfWeek == 1) { startDate = startDate.addDays(1); } else { listOfDates.add(startDate); startDate = startDate.addDays(1); } } } else { for(integer i=0;i<=totaldays;i++) { Date today = startDate; Date startOfWeek = today.toStartOfWeek(); Integer dayOfWeek = today.day()-startOfWeek.day(); if(dayOfWeek == 0 || dayOfWeek == 6 || dayOfWeek == 5) { startDate = startDate.addDays(1); } else { listOfDates.add(startDate); startDate = startDate.addDays(1); } } } return startDate; }
I tried adding
|| dayOfWeek == 5
when the checkbox is unchecked but it is still displaying Friday.
Any idea what might be the problem?
Pls check the rerender condition on the action function. If the particular UI element is not refreshed after unchecking this kinda problem may occur.
i checked the rerender condition but still having the problem.