Date.parse(nil) raises TypeError

Hello,

in Ruby 1.9 (ruby 1.9.1p378 (2010-01-10 revision 26273) [i386- mingw32])

the following code

require ‘date’
Date.parse(nil)

raises TypeError: can’t dup NilClass. I think it should be
“ArgumentError: invalid date”, same as what Date.parse reports for
strings with invalid date formats. Should I file a bug report?

On Apr 27, 2010, at 19:00 , Victor Kryukov wrote:

raises TypeError: can’t dup NilClass. I think it should be
“ArgumentError: invalid date”, same as what Date.parse reports for
strings with invalid date formats. Should I file a bug report?

sure. you can even provide a patch that raises the exception you’d
rather see. post your idea to [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs