Project

General

Profile

Bug #12271

`Time#to_time` removes timezone information

Added by yui-knk (Kaneko Yuichiro) almost 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290)
[ruby-core:74889]

Description

irb(main):001:0> RUBY_VERSION
=> "2.3.0"
irb(main):002:0> require 'date'
=> true
irb(main):003:0> ENV['TZ'] = 'US/Eastern'
=> "US/Eastern"
irb(main):004:0> time = Time.new(2005, 2, 21, 10, 11, 12, '+09:00')
=> 2005-02-21 10:11:12 +0900
irb(main):005:0> time.to_time
=> 2005-02-20 20:11:12 -0500

Same as https://bugs.ruby-lang.org/issues/12189, Time#to_time does not use self timezone.
I think it is better to make it to match with DateTime#to_time behavior.


Files

time.diff (1.35 KB) time.diff yui-knk (Kaneko Yuichiro), 04/12/2016 09:34 AM

Associated revisions

Revision 456523e2
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54553
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

Revision 54553
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

Revision 54553
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

Revision 54553
Added by nobu (Nobuyoshi Nakada) almost 3 years ago

date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

Revision 3f7cce9f
Added by yui-knk (Kaneko Yuichiro) almost 3 years ago

  • NEWS: Add descriptions for Time#to_time updates. [Bug #12271] [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 54725
Added by yui-knk (Kaneko Yuichiro) almost 3 years ago

  • NEWS: Add descriptions for Time#to_time updates. [Bug #12271] [ci skip]

Revision 54725
Added by yui-knk (Kaneko Yuichiro) almost 3 years ago

  • NEWS: Add descriptions for Time#to_time updates. [Bug #12271] [ci skip]

Revision 54725
Added by yui-knk (Kaneko Yuichiro) almost 3 years ago

  • NEWS: Add descriptions for Time#to_time updates. [Bug #12271] [ci skip]

Revision 54725
Added by yui-knk (Kaneko Yuichiro) almost 3 years ago

  • NEWS: Add descriptions for Time#to_time updates. [Bug #12271] [ci skip]

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 3 years ago

  • Status changed from Open to Closed

Applied in changeset r54553.


date_core.c: preserve timezone

  • ext/date/date_core.c (time_to_time): should preserve timezone info. [ruby-core:74889] [Bug #12271]

Updated by usa (Usaku NAKAMURA) almost 3 years ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED

Updated by yui-knk (Kaneko Yuichiro) almost 3 years ago

I feel this is a like feature change.

For example, it seems a rubyist felt this change be incompatibility.
https://github.com/rails/rails/issues/24617

Do you think this change is bug fix?

Updated by shyouhei (Shyouhei Urabe) almost 3 years ago

(It is up to the branch maintainers but) given the actual Rails breakage, my feeling is negative to classify this as something to backport.

Updated by usa (Usaku NAKAMURA) almost 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: REQUIRED, 2.3: REQUIRED to 2.1: WONTFIX, 2.2: WONTFIX, 2.3: UNKNOWN

Thank you for reporting.
I give up to backport this into ruby_2_2.

Updated by nagachika (Tomoyuki Chikanaga) almost 3 years ago

  • Backport changed from 2.1: WONTFIX, 2.2: WONTFIX, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: WONTFIX, 2.3: WONTFIX

Also available in: Atom PDF