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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jruby 1.7.4 Timezone is inverted when creating a Time object #801

Closed
flyinprogrammer opened this Issue Jun 11, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@flyinprogrammer
Copy link

commented Jun 11, 2013

So this is awkward. 馃悽

irb(main):001:0> Time.new(2013,4,22,14,18,05,'-05:00')
=> 2013-04-22 14:18:05 +0500
irb(main):002:0> Time.new(2013,4,22,14,18,05,'+05:00')
=> 2013-04-22 14:18:05 -0500

It would appear it's just the printing however, because this is reporting the correct data:

irb(main):005:0> Time.new(2013,4,22,14,18,05,'-05:00').zone
=> "GMT-5"

asarih knows things about this defect:

flyinprogramer: why is Time in jruby inverting the timezone ?
asarih: flyinprogramer: cause it was a bug.
asarih: I thought I fixed it鈥
asarih: it's not. :-S

@ghost ghost assigned BanzaiMan Jun 11, 2013

@pritchie

This comment has been minimized.

Copy link

commented Jun 11, 2013

For completeness. Ruby 1.9.3p429

Time.new(2013,4,22,14,18,05,'-05:00') # => 2013-04-22 14:18:05 -0500
Time.new(2013,4,22,14,18,05,'+05:00') # => 2013-04-22 14:18:05 +0500

# wuh?
Time.new(2013,4,22,14,18,05,'-05:00').zone # => nil
Time.new(2013,4,22,14,18,05,'-05:00').utc_offset # => -18000

BanzaiMan added a commit that referenced this issue Jun 16, 2013

Invert UTC offset sign if the object was created with a specific offset
Fixes #801.

When a Date object is created with 7 arguments, where the 7th argument
is the UTC offset, we need to invert the sign for the display since
Java's offset is the opposite of Ruby's.

BanzaiMan added a commit that referenced this issue Jun 16, 2013

BanzaiMan added a commit that referenced this issue Jun 16, 2013

@BanzaiMan

This comment has been minimized.

Copy link
Member

commented Jun 16, 2013

@pritchie By the way, #zone returning non-nil should probably be a separate ticket.

BanzaiMan added a commit that referenced this issue Jun 16, 2013

@BanzaiMan BanzaiMan closed this in 6188ee5 Jun 16, 2013

BanzaiMan added a commit that referenced this issue Jun 16, 2013

@BanzaiMan

This comment has been minimized.

Copy link
Member

commented Jun 16, 2013

Never mind that. I fixed #zone, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.