I have requirement, where i need to check the day is workingday or holiday for that i got one class but problem here is that, i have written trigger handler from handler class how can i pass date and holiday list to below class can anyone help me and also i am getting error while calling this method like this "boolean holidycheck= holidaylist.changeWeekendTaskDueDate(evetstartdate ,holidays);"
public boolean checkifItisWorkingDay(Date currentDate,List<Holiday> holidays)
{
Date weekStart = currentDate.toStartofWeek();
for(Holiday hDay:holidays)
{
if(currentDate.daysBetween(hDay.ActivityDate) == 0)
{
return false;
}
}
if(weekStart.daysBetween(currentDate) ==0 || weekStart.daysBetween(currentDate) == 6)
{
return false;
} else
return true;
Below is my trigger handler class
List<Holiday> holidays=[Select h.StartTimeInMinutes, h.Name, h.ActivityDate From Holiday h];
List<contact> conts = (List<contact>) newSobjs;//
List<Event> events = new List<Event>();
for (contact ri : conts )
{
Event evt = new Event(whatID = ri.ID);
evt.Subject = 'Bid Due Date for ' + ri.name;
Date evetstartdate = ri.Completion_Date__c;
boolean holidycheck= holidaylist.changeWeekendTaskDueDate(evetstartdate ,holidays);
evt.StartDateTime = evetstartdate;
evt.DurationInMinutes= 30;
events.add(evt);
}
insert events;