parsi-date 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/parsi-date.rb +2 -1
- data/lib/version.rb +1 -1
- data/spec/parsi-date/week_methods_spec.rb +4 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d3208eb15dffe3337029d416689f316b35ada0
|
4
|
+
data.tar.gz: 345fe584383351f93dedbe88dec53d69ab4da941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e30ea83c086ea01d854ce30dcb756007d298ebedf2531abbf05db90c1db55f0087ca28b59887483c5f7f64fe34307c7c54dfbc5b2e0d4f6018ff08284e98f17
|
7
|
+
data.tar.gz: b5452ff1d01c2983317da602d660c1c435c4789aaf7e36e2c9c2c8ae0e865ae228d092b4ac595e8a403a394d34c5ff0c43819f2e7a56a275771dcceceb441e30
|
data/lib/parsi-date.rb
CHANGED
@@ -585,7 +585,8 @@ module Parsi
|
|
585
585
|
|
586
586
|
# Returns the calendar week number (1-53).
|
587
587
|
def cweek
|
588
|
-
|
588
|
+
start = Date.civil(year, 1, 1)
|
589
|
+
((jd - start.jd + start.cwday - 5) / 7.0).ceil
|
589
590
|
end
|
590
591
|
|
591
592
|
# Return a new Date object that is +n+ months earlier than the current one.
|
data/lib/version.rb
CHANGED
@@ -7,7 +7,10 @@ end
|
|
7
7
|
|
8
8
|
describe "Parsi::Date#cweek?" do
|
9
9
|
it "returns the calendar week number (1-53)" do
|
10
|
-
Parsi::Date.civil(
|
10
|
+
Parsi::Date.civil(1393, 11, 30).cweek.should == 48
|
11
|
+
Parsi::Date.civil(1393, 12, 1).cweek.should == 48
|
12
|
+
Parsi::Date.civil(1393, 12, 29).cweek.should == 52
|
13
|
+
Parsi::Date.civil(1394, 1, 1).cweek.should == 1
|
11
14
|
Parsi::Date.civil(1394, 1, 7).cweek.should == 1
|
12
15
|
Parsi::Date.civil(1394, 1, 8).cweek.should == 2
|
13
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.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hassan Zamani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|