Module: Hellobase

Defined in:
lib/hellobase.rb,
lib/hellobase/version.rb,
lib/hellobase/core_ext.rb,
lib/hellobase/time_zones.rb,
lib/hellobase/core_ext/divide_by_zero.rb

Defined Under Namespace

Modules: DivideByZero Classes: Error

Constant Summary collapse

VERSION =
'0.1.16'
DATE_FORMAT =
/^\d{4}-\d{2}-\d{2}$/
TIME_FORMAT =
/^\d{2}:\d{2}:\d{2}$/
DATETIME_FORMAT =
/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$/

Class Method Summary collapse

Class Method Details

.domestic_time_zone_select_values(country_code) ⇒ Object



5
6
7
# File 'lib/hellobase/time_zones.rb', line 5

def domestic_time_zone_select_values(country_code)
  TZInfo::Country.get(country_code).zone_info.map {|z| [z.description || z.timezone.friendly_identifier(true), z.identifier] }
end

.foreign_time_zone_select_values(country_code) ⇒ Object



9
10
11
# File 'lib/hellobase/time_zones.rb', line 9

def foreign_time_zone_select_values(country_code)
  TZInfo::Country.all.reject {|c| c.code == country_code }.map(&:zone_info).flatten.uniq.map {|z| [z.description || z.timezone.friendly_identifier(false), z.identifier] }
end