iso8601 0.11.0 → 0.12.0

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
  SHA256:
3
- metadata.gz: ef47c91dbb621380a2f03ba6239e336eab42ee004d43b90a7a642314f283327f
4
- data.tar.gz: b388e38562f042754b00347e566c3ec6a80bac3bc318bbe6f5060393b23212c6
3
+ metadata.gz: 2cc31f1efb3e05bf8a044ee03aabbfbbda87a2e050b503cebb673764dc9207f1
4
+ data.tar.gz: 85f1a4acb0b3ed87753b6a0100847d69f6d5edb587c46f63fc67affd1f6b0559
5
5
  SHA512:
6
- metadata.gz: afe7dec488de8ff01f11276ba876395ff3eea79672f09ca205409965921cbc04f2a214b4cbbe2c3b2990a9a8bd389c83205815f935c4fc930306b6fa7ff10310
7
- data.tar.gz: 967b272cd21652fa5133dcef8a33491f7e66ecd669f91eb01d4692ae9770b1032ab45cb0a7c9161c2c836527e73da8524bcc10972f39df32ca91fed7db348363
6
+ metadata.gz: 2489374d7371e548d808875c7274bb9dfa4645b8754663b0ee11b1d8a74e7e93aaaf0c91954313b5a5d5dba3173e24cf70e819d8d02b3fc0624c53f89b926d5b
7
+ data.tar.gz: f342d126be742e40464172577bf3bcac8093deba1150b6bf890ce2eeec444eed4946b139626ca8a8b5af57bdb31b88d70f706abf2451f49113b6d7cd15e83bda
@@ -1,3 +1,7 @@
1
+ ## 0.12.0
2
+
3
+ * Fix `Months#to_seconds` from November (thanks @walterbrebels).
4
+
1
5
  ## 0.11.0
2
6
 
3
7
  * Add support for unary minus operator (thanks @walterbrebels).
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2015 Arnau Siches
1
+ Copyright (c) 2012-2018 Arnau Siches
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -18,7 +18,6 @@ times) standard.
18
18
  ## Build status
19
19
 
20
20
  [![Build Status](https://secure.travis-ci.org/arnau/ISO8601.png?branch=master)](http://travis-ci.org/arnau/ISO8601/)
21
- [![Dependency Status](https://gemnasium.com/arnau/ISO8601.svg)](https://gemnasium.com/arnau/ISO8601)
22
21
  [![Gem Version](https://badge.fury.io/rb/iso8601.svg)](http://badge.fury.io/rb/iso8601)
23
22
 
24
23
  ## Supported versions
@@ -76,7 +76,7 @@ module ISO8601
76
76
  else
77
77
  month = initial <= 12 ? initial : (initial % 12)
78
78
  month = 12 if month.zero?
79
- year = base.year + ((base.month + atom) / 12).to_i
79
+ year = initial <= 12 ? base.year : base.year + (initial / 12).to_i
80
80
  end
81
81
 
82
82
  (::Time.utc(year, month) - ::Time.utc(base.year, base.month)) / atom
@@ -1,5 +1,5 @@
1
1
  module ISO8601
2
2
  ##
3
3
  # The gem version
4
- VERSION = '0.11.0'.freeze
4
+ VERSION = '0.12.0'.freeze
5
5
  end
@@ -7,6 +7,9 @@ RSpec.describe ISO8601::Duration do
7
7
  let(:common_february) { ISO8601::DateTime.new('2010-02-01') }
8
8
  let(:leap_february) { ISO8601::DateTime.new('2000-02-01') }
9
9
 
10
+ let(:common_november) { ISO8601::DateTime.new('2010-11-01') }
11
+ let(:common_december) { ISO8601::DateTime.new('2010-12-01') }
12
+
10
13
  it "should raise a ISO8601::Errors::UnknownPattern for any unknown pattern" do
11
14
  expect { ISO8601::Duration.new('') }.to raise_error(ISO8601::Errors::UnknownPattern)
12
15
  expect { ISO8601::Duration.new('P') }.to raise_error(ISO8601::Errors::UnknownPattern)
@@ -120,6 +123,10 @@ RSpec.describe ISO8601::Duration do
120
123
  expect(ISO8601::Duration.new('P1M').to_seconds(common_year)).to eq(2678400)
121
124
  expect(ISO8601::Duration.new('P19M').to_seconds(ISO8601::DateTime.new('2012-05-01'))).to eq(Time.utc(2014, 12) - Time.utc(2012, 5))
122
125
  expect(ISO8601::Duration.new('P14M').to_seconds(common_year)).to eq(Time.utc(2011, 3) - Time.utc(2010, 1))
126
+ expect(ISO8601::Duration.new('P1M').to_seconds(common_november)).to eq(Time.utc(2010, 12) - Time.utc(2010, 11))
127
+ expect(ISO8601::Duration.new('P1M').to_seconds(common_december)).to eq(Time.utc(2011, 1) - Time.utc(2010, 12))
128
+ expect(ISO8601::Duration.new('P2M').to_seconds(common_november)).to eq(Time.utc(2011, 1) - Time.utc(2010, 11))
129
+ expect(ISO8601::Duration.new('P3M').to_seconds(common_november)).to eq(Time.utc(2011, 2) - Time.utc(2010, 11))
123
130
  end
124
131
 
125
132
  it "should return the seconds of a P[n]M duration in a leap year" do
@@ -7,6 +7,8 @@ RSpec.describe ISO8601::Months do
7
7
  let(:common_february) { ISO8601::DateTime.new('2010-02-01') }
8
8
  let(:leap_february) { ISO8601::DateTime.new('2000-02-01') }
9
9
 
10
+ let(:common_november) { ISO8601::DateTime.new('2017-11-01') }
11
+
10
12
  let(:common_december) { ISO8601::DateTime.new('2017-12-01') }
11
13
  let(:leap_december) { ISO8601::DateTime.new('2000-12-01') }
12
14
 
@@ -62,6 +64,9 @@ RSpec.describe ISO8601::Months do
62
64
  expect(ISO8601::Months.new(1).to_seconds(common_year)).to eq(2678400)
63
65
  expect(ISO8601::Months.new(0).to_seconds(common_year)).to eq(0)
64
66
  expect(ISO8601::Months.new(0).to_seconds(common_december)).to eq(0)
67
+ expect(ISO8601::Months.new(2).to_seconds(common_november)).to eq(5270400)
68
+ expect(ISO8601::Months.new(1).to_seconds(common_november)).to eq(2592000)
69
+ expect(ISO8601::Months.new(0).to_seconds(common_november)).to eq(0)
65
70
  end
66
71
 
67
72
  it "should return the amount of seconds for a leap year" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iso8601
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnau Siches
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec