From: Jeremy Evans Date: 2010-08-13T01:23:34+09:00 Subject: [ruby-core:31695] [Bug #3687] Date#rfc3339 does not include time, which breaks Date._rfc3339 Bug #3687: Date#rfc3339 does not include time, which breaks Date._rfc3339 http://redmine.ruby-lang.org/issues/show/3687 Author: Jeremy Evans Status: Open, Priority: Normal Category: lib ruby -v: ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-openbsd4.7] I'm not sure if the bug is in the rfc3339 instance method or the _rfc3339 class method, but there's an obvious disconnect between the two. I'm guessing the problem is in the instance method, as RFC3339 doesn't seem to mention dates without times (http://www.ietf.org/rfc/rfc3339.txt). $ irb -r date ruby-1.9.2-rc2 > Date.today.rfc3339 => "2010-08-12" ruby-1.9.2-rc2 > Date._rfc3339(Date.today.rfc3339) => nil ruby-1.9.2-rc2 > Date.rfc3339(Date.today.rfc3339) ArgumentError: invalid date from /home/jeremy/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/date.rb:1022:in `new_by_frags' from /home/jeremy/.rvm/rubies/ruby-1.9.2-rc2/lib/ruby/1.9.1/date.rb:1076:in `rfc3339' from (irb):1 from /home/jeremy/.rvm/rubies/ruby-1.9.2-rc2/bin/irb:17:in `
' A patch against trunk is attached which always includes the time and should fix things: $ irb -I date-rfc3339/ -r date ruby-1.9.2-rc2 > Date.today.rfc3339 => "2010-08-12T00:00:00+00:00" ruby-1.9.2-rc2 > Date._rfc3339(Date.today.rfc3339) => {:year=>2010, :mon=>8, :mday=>12, :hour=>0, :min=>0, :sec=>0, :zone=>"+00:00", :offset=>0} ruby-1.9.2-rc2 > Date.rfc3339(Date.today.rfc3339) => # This doesn't affect DateTime at all, as that uses the time already. ---------------------------------------- http://redmine.ruby-lang.org