Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date comparison as java objects #1520

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

Date comparison as java objects #1520

crschummer opened this issue Feb 21, 2014 · 2 comments
Milestone

Comments

@crschummer
Copy link

@crschummer crschummer commented Feb 21, 2014

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
Copy link
Contributor

@MSNexploder MSNexploder commented Jul 15, 2014

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
Copy link
Member

@mkristian mkristian commented Jul 15, 2014

@MSNexploder thanx for pointing this out

@mkristian mkristian closed this Jul 15, 2014
@enebo enebo added this to the JRuby 1.7.14 milestone Aug 27, 2014
@enebo enebo removed this from the JRuby 1.7.14 milestone Aug 27, 2014
@enebo enebo added this to the JRuby 1.7.15 milestone Aug 27, 2014
@enebo enebo removed this from the JRuby 1.7.15 milestone Aug 27, 2014
@enebo enebo added this to the JRuby 1.7.14 milestone Aug 27, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants