Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

next_month get stuck

#5935
>> DateTime.new(1125899999995008, 11).next_month
=> Sat, 01 Dec 1125899999995008 00:00:00 0000

it's OK, but this one get stuck

>> DateTime.new(1125899999995008, 12).next_month
^CIRB::Abort: abort then interrupt!!
        from /usr/lib/ruby/1.8/irb.rb:89:in `irb_abort'
        from /usr/lib/ruby/1.8/irb.rb:255:in `signal_handle'
        from /usr/lib/ruby/1.8/irb.rb:66
        from /usr/lib/ruby/1.8/date.rb:629:in `call'
        from /usr/lib/ruby/1.8/date.rb:629:in `valid_civil?'
        from /usr/lib/ruby/1.8/date.rb:1308:in `>>'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/date/calculations.rb:98:in `advance'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/date_time/calculations.rb:64:in `advance'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/date/calculations.rb:125:in `months_since'
        from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/date/calculations.rb:165:in `next_month'
        from (irb):22

Reported by eafou6g · November 9th, 2010 @ 12:51 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. eafou6g
    eafou6g

    I'm sorry, I found that it correctly throws ArgumentError exception on rails 3.0.1

    irb(main):004:0>  DateTime.new(1125899999995008, 12).next_month
    ArgumentError: invalid date
            from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/core_ext/date/calculations.rb:20:in `>>'
            from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/core_ext/date/calculations.rb:110:in `advance'
            from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/core_ext/date_time/calculations.rb:53:in `advance'
            from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/core_ext/date/calculations.rb:137:in `months_since'
            from /usr/lib/ruby/gems/1.8/gems/activesupport-3.0.1/lib/active_support/core_ext/date/calculations.rb:167:in `next_month'
            from (irb):4
    

    November 9th, 2010 @ 03:49 AM

  2. Elliot Winkler
    Elliot Winkler

    Which version of Rails were you testing in the first case?

    November 9th, 2010 @ 04:19 AM

  3. eafou6g
    eafou6g

    rails: 2.3.8
    ruby: ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

    Is it enough?

    November 9th, 2010 @ 04:31 AM

  4. Andrés Mejía
    Andrés Mejía

    I can confirm this on Ruby 1.9 and Rails 3.0.1. However, the exception is raised on Ruby's code and not Rails itself:

    $ rails c
    Loading development environment (Rails 3.0.1)
    ruby-1.9.2-p0 > DateTime.new(1125899999995008, 11).next_month
     => Sat, 01 Dec 1125899999995008 00:00:00 +0000 
    ruby-1.9.2-p0 > DateTime.new(1125899999995008, 12).next_month
    ArgumentError: invalid date
        from /Users/wack-a-mole/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/date.rb:1421:in `>>'
        from /Users/wack-a-mole/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/date.rb:1434:in `next_month'
        from (irb):2
        from /Users/wack-a-mole/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands/console.rb:44:in `start'
        from /Users/wack-a-mole/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands/console.rb:8:in `start'
        from /Users/wack-a-mole/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.1/lib/rails/commands.rb:23:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'
    

    November 9th, 2010 @ 11:32 AM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 11th, 2011 @ 07:18 PM

  6. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 11th, 2011 @ 07:18 PM

  7. eafou6g
    eafou6g

    It is not Rails' bug, but Ruby's.
    And it seems for me that it was fixed at ruby-1.8.7-p299.
    Anyway, please ignore this ticket.
    Thank you.

    $ ./script/console
    Loading development environment (Rails 2.3.8)
    ruby-1.8.7-p249 :001 > DateTime.new(1125899999995008, 12).next_month
    ^CIRB::Abort: abort then interrupt!!
    ...
    
    $ ./script/console
    Loading development environment (Rails 2.3.8)
    ruby-1.8.7-p299 :001 > DateTime.new(1125899999995008, 12).next_month
    ArgumentError: invalid date
    ...
    

    February 15th, 2011 @ 02:09 PM