rubysl-date 2.0.6 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -10
- data/lib/date/format.rb +4 -4
- data/lib/rubysl/date/date.rb +1 -1
- data/lib/rubysl/date/version.rb +1 -1
- data/spec/date/_parse_spec.rb +12 -0
- data/spec/time/to_date_spec.rb +27 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15a5c9e1a6382cebf9dcb0066e38531ed7dda2cc
|
4
|
+
data.tar.gz: 01a181b9bf7f42df885b2b5204f07aa1ae8e1826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e60fe68246f81777d2c291181322736ee670ae332b9723ffd5fd4e7eaea0816b236f291f075eec55725936f0241193e7ae755fb878c99a13599853ebb010a5b
|
7
|
+
data.tar.gz: 110f4dd874b0b96c40ff7922c571022d8f718e87ed936a2e1dced438347a9c9dd7601f092159c41e425a212a25af7f39ecfe93fb042029341d9dffef90d0a341
|
data/.travis.yml
CHANGED
data/lib/date/format.rb
CHANGED
@@ -559,8 +559,8 @@ class Date
|
|
559
559
|
e._cent ||= if val >= 69 then 19 else 20 end
|
560
560
|
when 'Z', /\A:{0,3}z/
|
561
561
|
return unless str.sub!(/\A((?:gmt|utc?)?[-+]\d+(?:[,.:]\d+(?::\d+)?)?
|
562
|
-
|[[:alpha:]
|
563
|
-
|[[:alpha:]]+(
|
562
|
+
|(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b
|
563
|
+
|(?-i:[[:alpha:]]+)(?:\\sdst)?\\b
|
564
564
|
)/ix, '')
|
565
565
|
val = $1
|
566
566
|
e.zone = val
|
@@ -718,9 +718,9 @@ class Date
|
|
718
718
|
(
|
719
719
|
(?:gmt|utc?)?[-+]\d+(?:[,.:]\d+(?::\d+)?)?
|
720
720
|
|
|
721
|
-
[[:alpha:].\s]+(?:standard|daylight)\stime\b
|
721
|
+
(?-i:[[:alpha:].\s]+)(?:standard|daylight)\stime\b
|
722
722
|
|
|
723
|
-
[[:alpha:]]+(?:\sdst)?\b
|
723
|
+
(?-i:[[:alpha:]]+)(?:\sdst)?\b
|
724
724
|
)
|
725
725
|
)?
|
726
726
|
/ix,
|
data/lib/rubysl/date/date.rb
CHANGED
@@ -1784,7 +1784,7 @@ class Time
|
|
1784
1784
|
def to_time() getlocal end
|
1785
1785
|
|
1786
1786
|
def to_date
|
1787
|
-
jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::
|
1787
|
+
jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::GREGORIAN)
|
1788
1788
|
Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
|
1789
1789
|
end
|
1790
1790
|
|
data/lib/rubysl/date/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
describe "Time#to_date" do
|
4
|
+
describe "date before the Gregorian calendar adoption in Italy" do
|
5
|
+
it "converts a Gregorian Time object into a Julian Date object" do
|
6
|
+
date = Time.local(1582, 10, 14).to_date
|
7
|
+
date.julian?.should be_true
|
8
|
+
date.gregorian?.should be_false
|
9
|
+
|
10
|
+
date.year.should == 1582
|
11
|
+
date.mon.should == 10
|
12
|
+
date.mday.should == 4
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "date after the Gregorian calendar adoption in Italy" do
|
17
|
+
it "converts a Gregorian Time object into a Gregorian Date object" do
|
18
|
+
date = Time.local(1582, 10, 15).to_date
|
19
|
+
date.julian?.should be_false
|
20
|
+
date.gregorian?.should be_true
|
21
|
+
|
22
|
+
date.year.should == 1582
|
23
|
+
date.mon.should == 10
|
24
|
+
date.mday.should == 15
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/rubysl/date/date.rb
|
89
89
|
- lib/rubysl/date/version.rb
|
90
90
|
- rubysl-date.gemspec
|
91
|
+
- spec/date/_parse_spec.rb
|
91
92
|
- spec/date/accessor_spec.rb
|
92
93
|
- spec/date/add_month_spec.rb
|
93
94
|
- spec/date/add_spec.rb
|
@@ -242,6 +243,7 @@ files:
|
|
242
243
|
- spec/datetime/to_time_spec.rb
|
243
244
|
- spec/datetime/xmlschema_spec.rb
|
244
245
|
- spec/datetime/zone_spec.rb
|
246
|
+
- spec/time/to_date_spec.rb
|
245
247
|
homepage: https://github.com/rubysl/rubysl-date
|
246
248
|
licenses:
|
247
249
|
- BSD
|
@@ -262,11 +264,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
264
|
version: '0'
|
263
265
|
requirements: []
|
264
266
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.
|
267
|
+
rubygems_version: 2.2.2
|
266
268
|
signing_key:
|
267
269
|
specification_version: 4
|
268
270
|
summary: Ruby standard library date.
|
269
271
|
test_files:
|
272
|
+
- spec/date/_parse_spec.rb
|
270
273
|
- spec/date/accessor_spec.rb
|
271
274
|
- spec/date/add_month_spec.rb
|
272
275
|
- spec/date/add_spec.rb
|
@@ -421,4 +424,4 @@ test_files:
|
|
421
424
|
- spec/datetime/to_time_spec.rb
|
422
425
|
- spec/datetime/xmlschema_spec.rb
|
423
426
|
- spec/datetime/zone_spec.rb
|
424
|
-
|
427
|
+
- spec/time/to_date_spec.rb
|