Method: ActiveScaffold::Finder::ClassMethods#datetime_from_to

Defined in:
lib/active_scaffold/finder.rb

#datetime_from_to(column, value) ⇒ Object



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/active_scaffold/finder.rb', line 378

def datetime_from_to(column, value)
  conversion = datetime_conversion_for_condition(column)
  case value['opt']
  when 'RANGE'
    values = datetime_from_to_for_range(column, value)
    # Avoid calling to_time, not needed and broken on rails >= 4, because return local time instead of UTC
    values.collect!(&conversion) if conversion != :to_time
    values
  when 'PAST', 'FUTURE'
    values = datetime_from_to_for_trend(column, value)
    # Avoid calling to_time, not needed and broken on rails >= 4, because return local time instead of UTC
    values.collect!(&conversion) if conversion != :to_time
    values
  else
    %w[from to].collect { |field| condition_value_for_datetime(column, value[field], conversion) }
  end
end