Sha256: ac5adfca27d954b87ee7783ab1b039a906e2b932d73b83de9d9be1d550eca403

Contents?: true

Size: 477 Bytes

Versions: 7

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true

module TimezoneFilter
  # Convert between timezones
  # Inspired by: http://customer.io/docs/dates-timezones.html
  # See: http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
  #
  # Examples:
  #
  # {{ date_time | timezone: 'Europe/Amsterdam' }}
  #
  # Changes like +3 or -4 or not (yet) possible
  def timezone(input, to_zone = 'UTC')
    input.utc.in_time_zone(to_zone)
  end
end

Liquid::Template.register_filter(TimezoneFilter)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
liquidum-1.2.1 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.2.0 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.1.2 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.1.1 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.1.0 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.0.22 lib/liquidum/liquid/filters/timezone_filter.rb
liquidum-1.0.17 lib/liquidum/liquid/filters/timezone_filter.rb