Bug #3687
closedDate#rfc3339 does not include time, which breaks Date._rfc3339
Description
=begin
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)
=> #<Date: 2010-08-12 (4910841/2,0,2299161)>
This doesn't affect DateTime at all, as that uses the time already.
=end
Files
Updated by naruse (Yui NARUSE) over 14 years ago
- Assignee set to tadf (tadayoshi funaba)
=begin
=end