Method: ActiveScaffold::Finder::ClassMethods#local_time_from_hash

Defined in:
lib/active_scaffold/finder.rb

#local_time_from_hash(value, conversion = :to_time) ⇒ Object



276
277
278
279
280
281
282
283
# File 'lib/active_scaffold/finder.rb', line 276

def local_time_from_hash(value, conversion = :to_time)
  time = Time.zone.local(*%i[year month day hour minute second].collect { |part| value[part].to_i })
  time.send(conversion)
rescue StandardError => e
  message = "Error creating time from #{value.inspect}:"
  Rails.logger.warn "#{message}\n#{e.message}\n#{e.backtrace.join("\n")}"
  nil
end