From: "mame (Yusuke Endoh)" Date: 2012-11-03T12:47:58+09:00 Subject: [ruby-core:48793] [ruby-trunk - Bug #6864][Assigned] bad value for range when using infinity with date or time Issue #6864 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to tadf (tadayoshi funaba) Target version set to 2.0.0 This is caused by the following behavior. p Date.today <=> 1.0 #=> 1 p 1.0 <=> Date.today #=> nil Funaba-san, what do you think? It may be good to provide Date#coerce. -- Yusuke Endoh ---------------------------------------- Bug #6864: bad value for range when using infinity with date or time https://bugs.ruby-lang.org/issues/6864#change-32285 Author: slbug (Alex Grebennik) Status: Assigned Priority: Normal Assignee: tadf (tadayoshi funaba) Category: Target version: 2.0.0 ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] Steps to reproduce: require 'date' Range.new(Date.today, 1.0/0.0) # works Range.new(-1.0/0.0, Date.today) # fails Range.new(Time.now, 1.0/0.0) # fails Range.new(-1.0/0.0, Time.now) # fails Tested on 1.9.3 and trunk. I think this is a bug, because there is no logic error. just ranges without one bound. -- http://bugs.ruby-lang.org/