rubysl-date 2.0.3 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubysl/date/date.rb +1 -1
- data/lib/rubysl/date/version.rb +1 -1
- data/spec/date/strptime_spec.rb +0 -10
- data/spec/datetime/strptime_spec.rb +20 -2
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb768a7464f9f34c86d995fb3a81c2aec0b47834
|
4
|
+
data.tar.gz: 31d3bbf56c48dd2e071d6d97d5864cbcc0e4940a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d902ebeb826bed5a8df6de5ed85a45427406b6fc9cca7684fbb1463e3c4d5b596e8179ac3de5ed567fc319b4353f73a6c08c53cdd21ae90872de51f17c82bb7e
|
7
|
+
data.tar.gz: 4ecca4b8c18460ecbfe6535e4ebc30e648b2435d2444e5fc3f5e1cbdb9147f054df2f354b9f568861e545ab2fb2a97de64a3a5c643cf3d1b4ae01117a81bbb66
|
data/lib/rubysl/date/date.rb
CHANGED
@@ -858,6 +858,7 @@ class Date
|
|
858
858
|
def self.rewrite_frags(elem) # :nodoc:
|
859
859
|
elem ||= {}
|
860
860
|
if seconds = elem[:seconds]
|
861
|
+
seconds += elem[:offset] if elem[:offset]
|
861
862
|
d, fr = seconds.divmod(86400)
|
862
863
|
h, fr = fr.divmod(3600)
|
863
864
|
min, fr = fr.divmod(60)
|
@@ -868,7 +869,6 @@ class Date
|
|
868
869
|
elem[:sec] = s
|
869
870
|
elem[:sec_fraction] = fr
|
870
871
|
elem.delete(:seconds)
|
871
|
-
elem.delete(:offset)
|
872
872
|
end
|
873
873
|
elem
|
874
874
|
end
|
data/lib/rubysl/date/version.rb
CHANGED
data/spec/date/strptime_spec.rb
CHANGED
@@ -62,16 +62,6 @@ describe "Date#strptime" do
|
|
62
62
|
Date.strptime("69", "%g").should == Date.civil(1968, 12, 30)
|
63
63
|
end
|
64
64
|
|
65
|
-
it "parses a second number since the Unix Epoch" do
|
66
|
-
DateTime.strptime("-1", "%s").should == DateTime.civil(1969, 12, 31, 23, 59, 59)
|
67
|
-
DateTime.strptime("-86400", "%s").should == DateTime.civil(1969, 12, 31, 0, 0, 0)
|
68
|
-
end
|
69
|
-
|
70
|
-
it "parses a millisecond number since the Unix Epoch" do
|
71
|
-
DateTime.strptime("-999", "%Q").should == DateTime.civil(1969, 12, 31, 23, 59, 59 + 1.to_r/10**3)
|
72
|
-
DateTime.strptime("-1000", "%Q").should == DateTime.civil(1969, 12, 31, 23, 59, 59)
|
73
|
-
end
|
74
|
-
|
75
65
|
it "parses a year day with leading zeroes" do
|
76
66
|
d = Date.today
|
77
67
|
if Date.gregorian_leap?(Date.today.year)
|
@@ -1,5 +1,23 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
|
-
describe "DateTime
|
4
|
-
|
3
|
+
describe "DateTime#strptime" do
|
4
|
+
|
5
|
+
it "uses the default format" do
|
6
|
+
DateTime.strptime("2000-04-06T01:01:01+01:00").should == DateTime.civil(2000, 4, 6, 1, 1, 1, '+1')
|
7
|
+
end
|
8
|
+
|
9
|
+
it "parses a second number since the Unix Epoch" do
|
10
|
+
DateTime.strptime("-1", "%s").should == DateTime.civil(1969, 12, 31, 23, 59, 59)
|
11
|
+
DateTime.strptime("-86400", "%s").should == DateTime.civil(1969, 12, 31, 0, 0, 0)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "parses a millisecond number since the Unix Epoch" do
|
15
|
+
DateTime.strptime("-999", "%Q").should == DateTime.civil(1969, 12, 31, 23, 59, 59 + 1.to_r/10**3)
|
16
|
+
DateTime.strptime("-1000", "%Q").should == DateTime.civil(1969, 12, 31, 23, 59, 59)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "parses seconds and timezone correctly" do
|
20
|
+
DateTime.strptime("0 +0100", "%s %z").should == DateTime.civil(1970, 1, 1, 1, 0, 0, '+1')
|
21
|
+
end
|
22
|
+
|
5
23
|
end
|
metadata
CHANGED
@@ -1,66 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubysl-date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
type: :development
|
15
14
|
name: bundler
|
16
|
-
prerelease: false
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
type: :development
|
29
28
|
name: rake
|
30
|
-
prerelease: false
|
31
29
|
requirement: !ruby/object:Gem::Requirement
|
32
30
|
requirements:
|
33
31
|
- - "~>"
|
34
32
|
- !ruby/object:Gem::Version
|
35
33
|
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
type: :development
|
43
42
|
name: mspec
|
44
|
-
prerelease: false
|
45
43
|
requirement: !ruby/object:Gem::Requirement
|
46
44
|
requirements:
|
47
45
|
- - "~>"
|
48
46
|
- !ruby/object:Gem::Version
|
49
47
|
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
type: :development
|
57
56
|
name: rubysl-prettyprint
|
58
|
-
prerelease: false
|
59
57
|
requirement: !ruby/object:Gem::Requirement
|
60
58
|
requirements:
|
61
59
|
- - "~>"
|
62
60
|
- !ruby/object:Gem::Version
|
63
61
|
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
265
|
+
rubygems_version: 2.0.7
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: Ruby standard library date.
|
@@ -421,3 +421,4 @@ test_files:
|
|
421
421
|
- spec/datetime/to_time_spec.rb
|
422
422
|
- spec/datetime/xmlschema_spec.rb
|
423
423
|
- spec/datetime/zone_spec.rb
|
424
|
+
has_rdoc:
|