Module: Teems::Support::Timezone

Included in:
Commands::Ooo, Commands::Who
Defined in:
lib/teems/support/timezone.rb

Overview

Shared timezone detection logic for calendar and schedule commands

Constant Summary collapse

TIMEZONE_MAP =
{
  'EST' => 'America/New_York', 'EDT' => 'America/New_York',
  'CST' => 'America/Chicago', 'CDT' => 'America/Chicago',
  'MST' => 'America/Denver', 'MDT' => 'America/Denver',
  'PST' => 'America/Los_Angeles', 'PDT' => 'America/Los_Angeles',
  'AKST' => 'America/Anchorage', 'AKDT' => 'America/Anchorage',
  'HST' => 'Pacific/Honolulu', 'UTC' => 'UTC', 'GMT' => 'UTC'
}.freeze

Instance Method Summary collapse

Instance Method Details

#detect_timezoneObject



16
17
18
# File 'lib/teems/support/timezone.rb', line 16

def detect_timezone
  tz_from_env || tz_from_system
end

#short_tz_labelObject



20
21
22
23
# File 'lib/teems/support/timezone.rb', line 20

def short_tz_label
  abbrev = tz_from_system_abbrev
  abbrev.gsub(/[DS](?=T$)/, '')
end