Skip to content

DateTime.iso8601 fails with an error (incompatibility) #2883

@kares

Description

@kares
jruby-1.7.19 :004 > require 'date'
 => true 
jruby-1.7.19 :005 > DateTime.parse '2014-07-08T17:51:36.000Z'
 => #<DateTime: 2014-07-08T17:51:36+00:00 ((2456847j,64296s,0n),+0s,2299161j)> 
jruby-1.7.19 :006 > puts DateTime.parse '2014-07-08T17:51:36.000Z'
2014-07-08T17:51:36+00:00
 => nil 
jruby-1.7.19 :007 > DateTime.iso8601('2014-07-08T17:51:36.000Z')
NoMethodError: undefined method `/' for "000":String
    from /opt/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/date.rb:1778:in `new_by_frags'
    from /opt/local/rvm/rubies/jruby-1.7.19/lib/ruby/1.9/date.rb:1829:in `iso8601'
    from (irb):7:in `evaluate'
    from org/jruby/RubyKernel.java:1107:in `eval'
    from org/jruby/RubyKernel.java:1507:in `loop'
    from org/jruby/RubyKernel.java:1270:in `catch'
    from org/jruby/RubyKernel.java:1270:in `catch'
    from /opt/local/rvm/rubies/jruby-1.7.19/bin/irb:13:in `(root)'

expected :

1.9.3-p551 :001 > require 'date'
 => true 
1.9.3-p551 :002 > DateTime.iso8601('2014-07-08T17:51:36.000Z')
 => #<DateTime: 2014-07-08T17:51:36+00:00 ((2456847j,64296s,0n),+0s,2299161j)> 
1.9.3-p551 :003 > puts DateTime.iso8601('2014-07-08T17:51:36.000Z')
2014-07-08T17:51:36+00:00
 => nil 

taken from: http://stackoverflow.com/questions/29786162/datetime-iso86012014-07-08t175136-000z-results-in-nomethoderror

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions