Project

General

Profile

Actions

Bug #3687

closed

Date#rfc3339 does not include time, which breaks Date._rfc3339

Added by jeremyevans0 (Jeremy Evans) over 13 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-openbsd4.7]
Backport:
[ruby-core:31695]

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

date-rfc3339.patch (256 Bytes) date-rfc3339.patch Patch for Date#rfc3339 jeremyevans0 (Jeremy Evans), 08/13/2010 01:21 AM
Actions #1

Updated by naruse (Yui NARUSE) over 13 years ago

  • Assignee set to tadf (tadayoshi funaba)

=begin

=end

Actions #2

Updated by tadf (tadayoshi funaba) over 13 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0