Module: Dynamoid::ApplicationTimeZone

Defined in:
lib/dynamoid/application_time_zone.rb

Class Method Summary collapse

Class Method Details

.at(value) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# 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_offsetObject



17
18
19
20
21
22
23
24
25
26
# 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