iso8601 0.11.0 → 0.12.0
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/CHANGELOG.md +4 -0
- data/LICENSE +1 -1
- data/README.md +0 -1
- data/lib/iso8601/months.rb +1 -1
- data/lib/iso8601/version.rb +1 -1
- data/spec/iso8601/duration_spec.rb +7 -0
- data/spec/iso8601/months_spec.rb +5 -0
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2cc31f1efb3e05bf8a044ee03aabbfbbda87a2e050b503cebb673764dc9207f1
         | 
| 4 | 
            +
              data.tar.gz: 85f1a4acb0b3ed87753b6a0100847d69f6d5edb587c46f63fc67affd1f6b0559
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2489374d7371e548d808875c7274bb9dfa4645b8754663b0ee11b1d8a74e7e93aaaf0c91954313b5a5d5dba3173e24cf70e819d8d02b3fc0624c53f89b926d5b
         | 
| 7 | 
            +
              data.tar.gz: f342d126be742e40464172577bf3bcac8093deba1150b6bf890ce2eeec444eed4946b139626ca8a8b5af57bdb31b88d70f706abf2451f49113b6d7cd15e83bda
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -18,7 +18,6 @@ times) standard. | |
| 18 18 | 
             
            ## Build status
         | 
| 19 19 |  | 
| 20 20 | 
             
            [](http://travis-ci.org/arnau/ISO8601/)
         | 
| 21 | 
            -
            [](https://gemnasium.com/arnau/ISO8601)
         | 
| 22 21 | 
             
            [](http://badge.fury.io/rb/iso8601)
         | 
| 23 22 |  | 
| 24 23 | 
             
            ## Supported versions
         | 
    
        data/lib/iso8601/months.rb
    CHANGED
    
    | @@ -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  | 
| 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
         | 
    
        data/lib/iso8601/version.rb
    CHANGED
    
    
| @@ -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
         | 
    
        data/spec/iso8601/months_spec.rb
    CHANGED
    
    | @@ -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. | 
| 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- | 
| 11 | 
            +
            date: 2018-07-28 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec
         |