module Dynamoid::ApplicationTimeZone

@private

Public Class Methods

at(value) click to toggle source
# File lib/dynamoid/application_time_zone.rb, line 6
def self.at(value)
  case Dynamoid::Config.application_timezone
  when :utc
    ActiveSupport::TimeZone['UTC'].at(value).to_datetime
  when :local
    Time.at(value).to_datetime
  when String
    ActiveSupport::TimeZone[Dynamoid::Config.application_timezone].at(value).to_datetime
  end
end
utc_offset() click to toggle source
# File lib/dynamoid/application_time_zone.rb, line 17
def self.utc_offset
  case Dynamoid::Config.application_timezone
  when :utc
    0
  when :local
    Time.now.utc_offset
  when String
    ActiveSupport::TimeZone[Dynamoid::Config.application_timezone].now.utc_offset
  end
end