Commit 2a2d0f93 authored by Alex Ives's avatar Alex Ives 🛑

Blood for the RuboCop Gods.

parent e4a012d5
Pipeline #101031632 passed with stages
in 2 minutes and 6 seconds
......@@ -12,13 +12,14 @@ def format_zones_json(zones, argument, time=Time.now)
# throwaway way to make a new date object in local time that we can convert to UTC based optionally with minutes/hours
time = Time.new(2000, 'jan', 1, (time_a[0] || time.hour), (time_a[1] || time.min), 0, time.strftime('%:z'))
time_string = time.strftime('%H:%M')
time = time.utc
items = zones.map do |member, offset|
member_time = (time + offset * 60 * 60)
{
title: "#{member_time.strftime('%H:%M')} - #{member}",
subtitle: "It is #{member_time.strftime('%H:%M')} for #{member} (UTC#{offset})",
subtitle: "At #{time_string} here it is #{member_time.strftime('%H:%M')} for #{member} (UTC#{offset})",
icon: {
path: "images/#{member_time.strftime('%H').to_i % 12}.png"
}
......
......@@ -12,7 +12,7 @@ describe 'get_zones' do
end
describe 'format_zones_json' do
let(:frozen_time) { Time.new(2016, 'jan', 06, 17, 00, 00, '+00:00') }
let(:frozen_time) { Time.new(2016, 'jan', 6, 17, 0, 0, '+00:00') }
let(:zones) do
{
'First' => -1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment