Time.utc can't handle hour 24 #1501

Closed
ghostganz opened this Issue Feb 11, 2014 · 1 comment

Projects

None yet

3 participants

@ghostganz
Contributor

I had some Rails code that broke when we went from MRI to JRuby, which I tracked down to this difference:

1.9.3-p448 :001 > Time.utc(2014, 2, 11, 24, 0)
=> 2014-02-12 00:00:00 UTC

2.1.0 :001 > Time.utc(2014, 2, 11, 24, 0)
=> 2014-02-12 00:00:00 UTC

jruby-1.7.10 :002 > Time.utc(2014, 2, 11, 24, 0)
ArgumentError: argument out of range.
from org/jruby/RubyTime.java:1114:in `utc'
...

The hour 24 is apparently ok according to the ISO standards, and the time formatting in iOS happily generates them, so we see a lot of them in our requests.

@ratnikov ratnikov added a commit to ratnikov/jruby that referenced this issue Feb 20, 2014
@ratnikov ratnikov Make RubyTime argument checking be same as mri.
This should fix jruby#1501
b5b17e4
@ratnikov
Contributor

Just sent out #1515 against 1.7 branch to fix this.

However do note, that it will only allow accepting 24:00:00, but not 24:00:01. However that behavior is consistent with MRI.

@jrubyci jrubyci pushed a commit that closed this issue Feb 21, 2014
@ratnikov ratnikov Make RubyTime argument checking be same as mri.
This should fix #1501
b5b17e4
@jrubyci jrubyci closed this in b5b17e4 Feb 21, 2014
@enebo enebo added this to the JRuby 1.7.11 milestone Feb 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment