worldtimeengine 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/worldtimeengine/client.rb +13 -2
- data/spec/worldtimeengine_spec.rb +2 -2
- data/worldtimeengine.gemspec +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -52,7 +52,7 @@ gem 'worldtimeengine'
|
|
52
52
|
response.time.zone.current.description
|
53
53
|
=> "Central European Summer Time"
|
54
54
|
response.time.zone.current.utc_offset
|
55
|
-
=> '+
|
55
|
+
=> '+02:00'
|
56
56
|
response.time.zone.current.is_dst
|
57
57
|
=> true
|
58
58
|
response.time.zone.current.effective_until
|
@@ -63,7 +63,7 @@ gem 'worldtimeengine'
|
|
63
63
|
response.time.zone.next.description
|
64
64
|
=> "Central European Time"
|
65
65
|
response.time.zone.next.utc_offset
|
66
|
-
=> "+
|
66
|
+
=> "+01:00"
|
67
67
|
response.time.zone.next.is_dst
|
68
68
|
=> false
|
69
69
|
response.time.zone.next.effective_until
|
@@ -51,7 +51,8 @@ module WorldTimeEngine
|
|
51
51
|
mash.time.zone.has_dst = to_boolean mash.time.zone.hasDST
|
52
52
|
|
53
53
|
mash.time.zone.current.is_dst = to_boolean mash.time.zone.current.isdst
|
54
|
-
|
54
|
+
|
55
|
+
mash.time.zone.current.utc_offset = to_formatted_offset mash.time.zone.current.utcoffset
|
55
56
|
|
56
57
|
# could be missing for not recognized IPs
|
57
58
|
unless mash.time.zone.current.effectiveUntil.nil?
|
@@ -60,7 +61,7 @@ module WorldTimeEngine
|
|
60
61
|
|
61
62
|
if mash.time.zone.has_dst
|
62
63
|
mash.time.zone.next.is_dst = to_boolean mash.time.zone.next.isdst
|
63
|
-
mash.time.zone.next.utc_offset = mash.time.zone.next.utcoffset
|
64
|
+
mash.time.zone.next.utc_offset = to_formatted_offset mash.time.zone.next.utcoffset
|
64
65
|
mash.time.zone.next.effective_until = Time.parse "#{mash.time.zone.next.effectiveUntil} #{mash.time.zone.next.abbreviation} #{mash.time.zone.next.utcoffset}"
|
65
66
|
end
|
66
67
|
end
|
@@ -68,6 +69,16 @@ module WorldTimeEngine
|
|
68
69
|
|
69
70
|
private
|
70
71
|
|
72
|
+
def to_formatted_offset(string)
|
73
|
+
return if string.nil?
|
74
|
+
|
75
|
+
if string.split(':').first.length == '+1'.length
|
76
|
+
string.gsub!('-', '-0')
|
77
|
+
string.gsub!('+', '+0')
|
78
|
+
end
|
79
|
+
string
|
80
|
+
end
|
81
|
+
|
71
82
|
def to_time(string)
|
72
83
|
Time.parse string
|
73
84
|
end
|
@@ -106,13 +106,13 @@ describe WorldTimeEngine do
|
|
106
106
|
response.time.zone.has_dst.should == true
|
107
107
|
response.time.zone.current.abbreviation.should == "CEST"
|
108
108
|
response.time.zone.current.description.should == "Central European Summer Time"
|
109
|
-
response.time.zone.current.utc_offset.should == '+
|
109
|
+
response.time.zone.current.utc_offset.should == '+02:00'
|
110
110
|
response.time.zone.current.is_dst.should == true
|
111
111
|
response.time.zone.current.effective_until.should == Time.parse("2012-10-28 03:00:00")
|
112
112
|
|
113
113
|
response.time.zone.next.abbreviation.should == 'CET'
|
114
114
|
response.time.zone.next.description.should == "Central European Time"
|
115
|
-
response.time.zone.next.utc_offset.should == "+
|
115
|
+
response.time.zone.next.utc_offset.should == "+01:00"
|
116
116
|
response.time.zone.next.is_dst.should == false
|
117
117
|
response.time.zone.next.effective_until.should == Time.parse("2013-03-31 02:00:00")
|
118
118
|
end
|
data/worldtimeengine.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldtimeengine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash:
|
146
|
+
hash: -999268238348806578
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|