Skip to content

Commit

Permalink
Added some tzinfo action.
Browse files Browse the repository at this point in the history
  • Loading branch information
onewheelskyward committed Jul 3, 2016
1 parent ab2231f commit 77917a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion lib/lita/handlers/forecasts.rb
@@ -1,3 +1,5 @@
require 'tzinfo'

module ForecastIo
module Forecasts
def ascii_rain_forecast(forecast)
Expand Down Expand Up @@ -476,8 +478,11 @@ def do_the_windows_thing(forecast)
if time_to_close_the_windows.nil?
"Leave 'em open, no excess heat today."
else
timezone = TZInfo::Timezone.get('America/Los_Angeles')
time_at = Time.at(time_to_close_the_windows).to_datetime
"Close the windows at #{time_at.strftime('%k:%M')}."
local_time = timezone.utc_to_local(time_at)

"Close the windows at #{local_time.strftime('%k:%M')}."
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion lita-onewheel-forecast-io.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'lita-onewheel-forecast-io'
spec.version = '1.3.6'
spec.version = '1.3.7'
spec.authors = ['Andrew Kreps']
spec.email = ['andrew.kreps@gmail.com']
spec.description = <<-EOS
Expand Down Expand Up @@ -33,4 +33,5 @@ EOS
spec.add_runtime_dependency 'geocoder', '~> 1.2'
spec.add_runtime_dependency 'multi_json', '~> 1.7'
spec.add_runtime_dependency 'magic-eightball', '~> 0.0'
spec.add_runtime_dependency 'tzinfo', '~> 1.2'
end
2 changes: 1 addition & 1 deletion spec/lita/handlers/forecast_io_spec.rb
Expand Up @@ -513,7 +513,7 @@ def mock_up(filename)
it '!windows' do
mock_up 'windows'
send_command 'windows'
expect(replies.last).to eq('Shut them down at 16:00.')
expect(replies.last).to eq('Close the windows at 16:00.')
end

# it 'colors strings' do
Expand Down

0 comments on commit 77917a5

Please sign in to comment.