Class: ReeDatetime::HumanZoneOffset

Inherits:
Object
  • Object
show all
Includes:
Ree::FnDSL
Defined in:
lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/human_zone_offset.rb

Instance Method Summary collapse

Instance Method Details

#call(human_zone_name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/ree_lib/packages/ree_datetime/package/ree_datetime/functions/human_zone_offset.rb', line 14

def call(human_zone_name)
  if !ZONE_HUMAN_NAMES.has_key?(human_zone_name)
    raise ArgumentError, "invalid human zone name"
  end

  zone = ZONE_HUMAN_NAMES[human_zone_name]
  tzinfo = find_tzinfo(zone)

  offset_to_string(tzinfo.utc_offset)
end