parsi-date 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f6591ac27ee5b75937f1c0009193a2365581714
4
- data.tar.gz: c8f6ff22752cffe88c9c7a53f31bb2b18771ad15
3
+ metadata.gz: a3d3208eb15dffe3337029d416689f316b35ada0
4
+ data.tar.gz: 345fe584383351f93dedbe88dec53d69ab4da941
5
5
  SHA512:
6
- metadata.gz: f9b2772a0a521e5c28d3b48b47730e383cfea864953c0a76deaa0827826552afdca71cc7535fde7b8eb79f50c7ce9838bb616d735938e784fa4cc4b42aa7ed4a
7
- data.tar.gz: 821b2229b82af844d9cb1b0cdd2daac1fce70ad7d433e795e951fc8b741c8a31e26e5276626ce7de1a85dae7aaccdfbfde42bf0e52feeee17df66b153ff4c3ae
6
+ metadata.gz: 6e30ea83c086ea01d854ce30dcb756007d298ebedf2531abbf05db90c1db55f0087ca28b59887483c5f7f64fe34307c7c54dfbc5b2e0d4f6018ff08284e98f17
7
+ data.tar.gz: b5452ff1d01c2983317da602d660c1c435c4789aaf7e36e2c9c2c8ae0e865ae228d092b4ac595e8a403a394d34c5ff0c43819f2e7a56a275771dcceceb441e30
@@ -585,7 +585,8 @@ module Parsi
585
585
 
586
586
  # Returns the calendar week number (1-53).
587
587
  def cweek
588
- (jd - Date.send(:first_day_of_year, year)) / 7 + 1
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.
@@ -1,5 +1,5 @@
1
1
  module Parsi
2
2
  class Date
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -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(1394, 1, 3).cweek.should == 1
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.0
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-04 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler