parsi-date 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/parsi-date.rb +10 -0
- data/lib/version.rb +1 -1
- data/spec/parsi-date/leap_spec.rb +7 -7
- data/spec/parsi-date/week_methods_spec.rb +16 -0
- metadata +17 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09d7a4dd729c919bfe1581622f91a4bbd6683c07
|
4
|
+
data.tar.gz: 5ecfbdb3ca6b71f33801bc23e982d92216b27f55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ddd7582efd18f2a11529c84e40bcc025acdcccc49312f6e03c2a6056b248d72c55058c1c35ed7d0f7f8b9787ca223bc0fea87c0dc4cda160b91b7b57f445d72
|
7
|
+
data.tar.gz: 15e6155dfec566a015303c58e16518e20e9e67c72e9093f9bfcf601c63408dbda1fccb0faaf2f7ac8229a77afd3b75bc3bcce3b009b68902f02ef3db9e171802
|
data/lib/parsi-date.rb
CHANGED
@@ -576,6 +576,16 @@ module Parsi
|
|
576
576
|
self + (jd2 - jd)
|
577
577
|
end
|
578
578
|
|
579
|
+
# Returns the day of calendar week (1-7, Monday is 1)
|
580
|
+
def cwday
|
581
|
+
to_gregorian.cwday
|
582
|
+
end
|
583
|
+
|
584
|
+
# Returns the calendar week number (1-53).
|
585
|
+
def cweek
|
586
|
+
(jd - Date.send(:first_day_of_year, year)) / 7 + 1
|
587
|
+
end
|
588
|
+
|
579
589
|
# Return a new Date object that is +n+ months earlier than the current one.
|
580
590
|
#
|
581
591
|
# If the day-of-the-month of the current Date is greater than the last day of
|
data/lib/version.rb
CHANGED
@@ -2,14 +2,14 @@ require File.expand_path('../../spec_helper', __FILE__)
|
|
2
2
|
|
3
3
|
describe "Parsi::Date#leap?" do
|
4
4
|
it "returns true if a year is a leap year in the Parsi (Jalali) calendar" do
|
5
|
-
Parsi::Date.leap?(1387).should
|
6
|
-
Parsi::Date.leap?(1391).should
|
7
|
-
Parsi::Date.leap?(1395).should
|
5
|
+
Parsi::Date.leap?(1387).should be_truthy
|
6
|
+
Parsi::Date.leap?(1391).should be_truthy
|
7
|
+
Parsi::Date.leap?(1395).should be_truthy
|
8
8
|
end
|
9
9
|
|
10
10
|
it "returns false if a year is not a leap year in the Parsi (Jalali) calendar" do
|
11
|
-
Parsi::Date.leap?(1390).should
|
12
|
-
Parsi::Date.leap?(1392).should
|
13
|
-
Parsi::Date.leap?(1400).should
|
11
|
+
Parsi::Date.leap?(1390).should be_falsey
|
12
|
+
Parsi::Date.leap?(1392).should be_falsey
|
13
|
+
Parsi::Date.leap?(1400).should be_falsey
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe "Parsi::Date#cwday?" do
|
4
|
+
it "returns the day of calendar week (1-7, Monday is 1)" do
|
5
|
+
Parsi::Date.civil(1393, 12, 3).cwday.should == 7
|
6
|
+
Parsi::Date.civil(1394, 1, 3).cwday.should == 1
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "Parsi::Date#cweek?" do
|
11
|
+
it "returns the calendar week number (1-53)" do
|
12
|
+
Parsi::Date.civil(1394, 1, 3).cweek.should == 1
|
13
|
+
Parsi::Date.civil(1394, 1, 7).cweek.should == 1
|
14
|
+
Parsi::Date.civil(1394, 1, 8).cweek.should == 2
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsi-date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hassan Zamani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- spec/parsi-date/leap_spec.rb
|
81
81
|
- spec/parsi-date/step_spec.rb
|
82
82
|
- spec/parsi-date/strftime_spec.rb
|
83
|
+
- spec/parsi-date/week_methods_spec.rb
|
83
84
|
- spec/spec_helper.rb
|
84
85
|
homepage: http://github.com/hzamani/parsi-date
|
85
86
|
licenses:
|
@@ -101,9 +102,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
104
|
rubyforge_project:
|
104
|
-
rubygems_version: 2.
|
105
|
+
rubygems_version: 2.4.5
|
105
106
|
signing_key:
|
106
107
|
specification_version: 4
|
107
108
|
summary: Solar Hijri (Jalali, Persian, Parsi) date library for Ruby
|
108
|
-
test_files:
|
109
|
+
test_files:
|
110
|
+
- spec/parsi-date/accessor_spec.rb
|
111
|
+
- spec/parsi-date/add_month_spec.rb
|
112
|
+
- spec/parsi-date/add_spec.rb
|
113
|
+
- spec/parsi-date/comp_spec.rb
|
114
|
+
- spec/parsi-date/constants_spec.rb
|
115
|
+
- spec/parsi-date/construction_spec.rb
|
116
|
+
- spec/parsi-date/conversion_spec.rb
|
117
|
+
- spec/parsi-date/leap_spec.rb
|
118
|
+
- spec/parsi-date/step_spec.rb
|
119
|
+
- spec/parsi-date/strftime_spec.rb
|
120
|
+
- spec/parsi-date/week_methods_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
109
122
|
has_rdoc:
|