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

Inconsistent TimeWithZone equality checks #4892

Closed
NC-phuh opened this issue Dec 11, 2017 · 5 comments
Closed

Inconsistent TimeWithZone equality checks #4892

NC-phuh opened this issue Dec 11, 2017 · 5 comments

Comments

@NC-phuh
Copy link

NC-phuh commented Dec 11, 2017

Environment

  • jruby-9.1.15.0

  • rails 4

  • 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

Expected Behavior

The following occurs in MRI ruby:

> DateTime.now.in_time_zone('Eastern Time (US & Canada)') == DateTime.now.utc
=> true

Actual Behavior

In Jruby-9.1.15.0:

> DateTime.now.in_time_zone('Eastern Time (US & Canada)') == DateTime.now.utc
=> false
@headius
Copy link
Member

headius commented Dec 12, 2017

I'm not sure where this in_time_zone method comes from. Can you provide a standalone script that we can run?

@NC-phuh
Copy link
Author

NC-phuh commented Dec 12, 2017

@headius It's from rails:

Here's a snippet that should run

gem 'rails', '4.2.8'
require 'rails'

puts "#{DateTime.now.in_time_zone('Eastern Time (US & Canada)') == DateTime.now.utc} should be true"

@headius
Copy link
Member

headius commented Dec 12, 2017

Confirmed on jruby-9.1 branch as well.

@headius
Copy link
Member

headius commented Mar 1, 2018

Still failing on current JRuby master (9.2).

@headius headius added this to the JRuby 9.2.0.0 milestone Mar 1, 2018
@kares
Copy link
Member

kares commented May 24, 2018

let's have it - this is slightly 🤧 since one should never expect a time clock to return the same
... just because its on the same line, teste the following script:

require 'date'
require 'active_support/all'

puts ActiveSupport::VERSION::STRING

now = DateTime.now
puts inz = now.in_time_zone('Eastern Time (US & Canada)')
puts utc = now.utc

puts inz == utc

9.2 (master) output:

4.2.10
2018-05-24 05:24:43 -0400
2018-05-24T09:24:43+00:00
true

same with 9.1.16.0 + AS 5.1 :

5.1.6
2018-05-24 05:27:39 -0400
2018-05-24 09:27:39 UTC
true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants