This project is archived and is in readonly mode.
next_month get stuck
Reported by eafou6g | November 9th, 2010 @ 12:51 AM
>> 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
Comments and changes to this ticket
-
eafou6g November 9th, 2010 @ 03:49 AM
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
-
Elliot Winkler November 9th, 2010 @ 04:19 AM
Which version of Rails were you testing in the first case?
-
eafou6g November 9th, 2010 @ 04:31 AM
rails: 2.3.8
ruby: ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]Is it enough?
-
Andrés Mejía November 9th, 2010 @ 11:32 AM
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>'
-
Santiago Pastorino February 11th, 2011 @ 07:18 PM
- 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.
-
Santiago Pastorino February 11th, 2011 @ 07:18 PM
- State changed from open to stale
-
eafou6g February 15th, 2011 @ 02:09 PM
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 ...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>