Module: Condensation::Filters::InTimeZone

Defined in:
lib/condensation/filters/in_time_zone.rb

Instance Method Summary collapse

Instance Method Details

#in_time_zone(input, zone_name = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/condensation/filters/in_time_zone.rb', line 7

def in_time_zone(input, zone_name = nil)
  zone = Time.find_zone(zone_name)
  return input if zone.nil?

  converted_time = if input.is_a?(Time)
                     input.in_time_zone(zone)
                   else
                     zone.parse(input)
                   end

  converted_time
end