Date comparison as java objects #1520

Closed
crschummer opened this Issue Feb 21, 2014 · 2 comments

Projects

None yet

4 participants

@crschummer

Starting in jruby-1.7.5 the compareTo of Dates converted to java objects seems to be broken:

in 1.7.4:
jruby-1.7.4 :003 > Date.today.to_java.compareTo((Date.today - 1).to_java)
=> 1
jruby-1.7.4 :004 > Date.today.to_java.compareTo((Date.today).to_java)
=> 0
jruby-1.7.4 :005 > Date.today.to_java.compareTo((Date.today + 1).to_java)
=> -1

In 1.7.5:
jruby-1.7.5 :005 > Date.today.to_java.compareTo((Date.today - 1).to_java)
=> 0
jruby-1.7.5 :006 > Date.today.to_java.compareTo((Date.today).to_java)
=> 0
jruby-1.7.5 :007 > Date.today.to_java.compareTo((Date.today + 1).to_java)
=> 0

This is also the case in the 1.7.10 release.

@MSNexploder
Contributor

i guess this could be closed.

JRuby 1.7.13

irb(main):001:0> Date.today.to_java.compareTo((Date.today - 1).to_java)
=> 1
irb(main):002:0> Date.today.to_java.compareTo((Date.today).to_java)
=> 0
irb(main):003:0> Date.today.to_java.compareTo((Date.today + 1).to_java)
=> -1
@mkristian
Member

@MSNexploder thanx for pointing this out

@mkristian mkristian closed this Jul 15, 2014
@enebo enebo modified the milestone: JRuby 1.7.14, JRuby 1.7.15 Aug 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment