-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
zone_spec.rb fails SPEC test "Time#zone returns UTC when called on a UTC time" #3304
Comments
joda was updated for JRuby 1.7.22, released last week, and 9.0.1.0 released yesterday. Are you seeing these issues with the latest releases? |
Neither 1.7.22 nor 9.0.1.0 appear to fail the spec in question here, so I will be marking this fixed in those releases. Let me know if you're still seeing an issue. |
@headius you are right that running it against joda-time 1.8.1 or earlier will prevent the issues, but I wouldn't call that fixing them. The underlying problem is still there, if joda-time getShortName presents yet another problem in the future, then the issues will show up again. IMHO JRuby itself should be more resilient and behave as closely as expected by the spec. The following patch would fix it.
Let me know if that is a reasonable fix. I can also create a pull request for it. |
@tdaitx both jruby-1.7.22 and jruby-9.0.0.0 default to joda-2.8.2: https://github.com/jruby/jruby/blob/9.0.1.0/pom.rb#L80 I do not understand your remark. if your patch brings JRuby closer to MRI and passes all specs then go for PR. @headius ??? |
As per Ruby's Time#zone [1] UTC should be used instead of GMT since Ruby 1.8. This also fixes jruby#3304. [1] http://ruby-doc.org/core-2.2.3/Time.html#method-i-zone
@mkristian I meant that the tests work fine when joda-time behaves as expected, otherwise JRuby will fail the tests, IMHO it shouldn't depend so much on joda-time. I have created #3310 to fix this. =) Thanks! |
return UTC instead of GMT (fixes #3304)
As described in #3303 the combination of joda-time <= 2.8.0 and OpenJDK 8u60 or earlier causes joda-time to return a [+-]hh:mm TZ format when calling
DateTimeZone.getShortName()
orDateTimeZone.getName()
. This in turn causesRubyTime.zone()
to return GMT instead of UTC by following a different code path then usual.Current result
Expected result
As per Time#zone documentation it should return UTC.
Offending code
I believe that the
if (zone.equals("+00:00")
bellow should return UTC instead of GMT.RubyTime.zone() [890-908]
The text was updated successfully, but these errors were encountered: