class Holidays::Finder::Context::Search

def build_date(year, month, h)

def build_date(year, month, h)
  if h[:function]
    holiday = custom_holiday(year, month, h)
    #FIXME The result should always be present, see https://github.com/holidays/holidays/issues/204 for more information
    current_month = holiday&.month
    current_day = holiday&.mday
  else
    current_month = month
    current_day = h[:mday] || @day_of_month_calculator.call(year, month, h[:week], h[:wday])
  end
  # Silently skip bad mdays
  #TODO Should we be doing something different here? We have no concept of logging right now. Maybe we should add it?
  Date.civil(year, current_month, current_day) rescue nil
end