class Ransack::Nodes::Value

def cast_to_date(val)

def cast_to_date(val)
  if val.respond_to?(:to_date)
    val.to_date rescue nil
  else
    y, m, d = *[val].flatten
    m ||= 1
    d ||= 1
    Date.new(y, m, d) rescue nil
  end
end