hackapp_gem 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hackapp_gem/version.rb +1 -1
- data/lib/hackapp_gem.rb +6 -6
- data/spec/lib/hackapp_gem_spec.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fb266edaef31f2e8cae15a0f208a605e243e20a
|
4
|
+
data.tar.gz: c5b9a63b45b97f8e5611ec6ca4d9a86f46273004
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff5b1bcd9e0d9cc701e4834fabc3e46419c97a7fbab131ef8617f9c408605bdca869989d31ac49992f4b8a9ea1bc63ed2a47b456e5ddf3cf2c52976c267390f1
|
7
|
+
data.tar.gz: 8e6130ccf6abe530943c45082bb7b9252885b7e3b4bea3451404094b12f4c6d7bcaeae0cbae26c9ef6d848c727af87342652c34fe018240661c16d939fdb90b1
|
data/lib/hackapp_gem/version.rb
CHANGED
data/lib/hackapp_gem.rb
CHANGED
@@ -3,11 +3,11 @@ require "hackapp_gem/version"
|
|
3
3
|
module HackappGem
|
4
4
|
class ::Time
|
5
5
|
|
6
|
-
# times in database are eastern time
|
6
|
+
# assuming all times in database are eastern time
|
7
7
|
def to_UTC
|
8
8
|
begin
|
9
|
-
shift_to_UTC =
|
10
|
-
self.to_datetime.advance(:hours => shift_to_UTC).
|
9
|
+
shift_to_UTC = 4
|
10
|
+
self.to_datetime.advance(:hours => shift_to_UTC).to_time
|
11
11
|
rescue Exception => e
|
12
12
|
puts "Unrecognizeable timezone: #{e}"
|
13
13
|
end
|
@@ -15,9 +15,9 @@ module HackappGem
|
|
15
15
|
|
16
16
|
# adjust according to what you want to view
|
17
17
|
def change_timezone(options)
|
18
|
-
zones = {"eastern" => -
|
19
|
-
"central" => -
|
20
|
-
"mountain" => -
|
18
|
+
zones = {"eastern" => -4,
|
19
|
+
"central" => -5,
|
20
|
+
"mountain" => -6,
|
21
21
|
"arizona" => -7,
|
22
22
|
"pacific" => -8,
|
23
23
|
"alaska" => -9,
|
@@ -3,14 +3,15 @@ require 'spec_helper'
|
|
3
3
|
describe HackappGem do
|
4
4
|
|
5
5
|
it "converts times to correct UTC using to_UTC" do
|
6
|
+
Time.zone = "EST"
|
6
7
|
eastern_time = Time.new()
|
7
|
-
eastern_time.
|
8
|
+
expect(eastern_time.to_UTC.strftime("%B %d, %Y @ %I:%M%p")).to eql(eastern_time.utc.strftime("%B %d, %Y @ %I:%M%p"))
|
8
9
|
end
|
9
10
|
|
10
11
|
it "converts times to specified time zones" do
|
12
|
+
Time.zone = "EST"
|
11
13
|
eastern_time = Time.new()
|
12
|
-
|
13
|
-
eastern_time == utc_time.change_timezone({new_timezone: "eastern"})
|
14
|
+
expect(eastern_time.strftime("%B %d, %Y @ %I:%M%p")).to eql(eastern_time.utc.change_timezone({new_timezone: "eastern"}).strftime("%B %d, %Y @ %I:%M%p"))
|
14
15
|
end
|
15
16
|
|
16
17
|
end
|