rails icon indicating copy to clipboard operation
rails copied to clipboard

ActiveSupport::TimeZone.us_zones behavior changed between Rails 5.0.2 and 5.0.3

Open BigGillyStyle opened this issue 6 years ago • 7 comments

Steps to reproduce

  1. Open a Rails console
  2. Execute ActiveSupport::TimeZone.us_zones
  3. Rails 5.0.2:
irb(main):007:0> ActiveSupport::TimeZone.us_zones
[
  [0] #<ActiveSupport::TimeZone:0x0055c0da6952a8 @name="Hawaii", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: Pacific/Honolulu>>,
  [1] #<ActiveSupport::TimeZone:0x0055c0d98606d8 @name="Alaska", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Juneau>>,
  [2] #<ActiveSupport::TimeZone:0x0055c0da666598 @name="Pacific Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Los_Angeles>>,
  [3] #<ActiveSupport::TimeZone:0x0055c0da660cb0 @name="Arizona", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Phoenix>>,
  [4] #<ActiveSupport::TimeZone:0x0055c0da6460b8 @name="Mountain Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Denver>>,
  [5] #<ActiveSupport::TimeZone:0x0055c0da60c5e8 @name="Central Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Chicago>>,
  [6] #<ActiveSupport::TimeZone:0x0055c0d1e9b348 @name="Eastern Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/New_York>>,
  [7] #<ActiveSupport::TimeZone:0x0055c0da5ff578 @name="Indiana (East)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Indianapolis>>
]
  1. Rails 5.0.3:
irb(main):001:0> ActiveSupport::TimeZone.us_zones
[
  [ 0] #<ActiveSupport::TimeZone:0x005568a38f2828 @name="America/Adak", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Adak>>,
  [ 1] #<ActiveSupport::TimeZone:0x005568a38f2800 @name="Hawaii", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: Pacific/Honolulu>>,
  [ 2] #<ActiveSupport::TimeZone:0x005568a3683a60 @name="Alaska", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Juneau>>,
  [ 3] #<ActiveSupport::TimeZone:0x005568a3683a88 @name="America/Anchorage", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Anchorage>>,
  [ 4] #<ActiveSupport::TimeZone:0x005568a37492d8 @name="America/Metlakatla", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Metlakatla>>,
  [ 5] #<ActiveSupport::TimeZone:0x005568a3871e08 @name="America/Nome", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Nome>>,
  [ 6] #<ActiveSupport::TimeZone:0x005568a36fe530 @name="America/Sitka", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Sitka>>,
  [ 7] #<ActiveSupport::TimeZone:0x005568a37a2d60 @name="America/Yakutat", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Yakutat>>,
  [ 8] #<ActiveSupport::TimeZone:0x005568a353d390 @name="Pacific Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Los_Angeles>>,
  [ 9] #<ActiveSupport::TimeZone:0x005568a3550f58 @name="America/Boise", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Boise>>,
  [10] #<ActiveSupport::TimeZone:0x005568a3550f30 @name="Arizona", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Phoenix>>,
  [11] #<ActiveSupport::TimeZone:0x005568a3493728 @name="Mountain Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Denver>>,
  [12] #<ActiveSupport::TimeZone:0x005568a3235648 @name="America/Indiana/Knox", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Knox>>,
  [13] #<ActiveSupport::TimeZone:0x005568a31adf68 @name="America/Indiana/Tell_City", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Tell_City>>,
  [14] #<ActiveSupport::TimeZone:0x005568a32c6738 @name="America/Menominee", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Menominee>>,
  [15] #<ActiveSupport::TimeZone:0x005568a3493750 @name="America/North_Dakota/Beulah", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/North_Dakota/Beulah>>,
  [16] #<ActiveSupport::TimeZone:0x005568a3384da0 @name="America/North_Dakota/Center", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/North_Dakota/Center>>,
  [17] #<ActiveSupport::TimeZone:0x005568a342b5d8 @name="America/North_Dakota/New_Salem", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/North_Dakota/New_Salem>>,
  [18] #<ActiveSupport::TimeZone:0x005568a305a2b0 @name="Central Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Chicago>>,
  [19] #<ActiveSupport::TimeZone:0x005568a2e0bc98 @name="America/Detroit", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Detroit>>,
  [20] #<ActiveSupport::TimeZone:0x005568a2f9cbc0 @name="America/Indiana/Marengo", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Marengo>>,
  [21] #<ActiveSupport::TimeZone:0x005568a30226d0 @name="America/Indiana/Petersburg", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Petersburg>>,
  [22] #<ActiveSupport::TimeZone:0x005568a305a2d8 @name="America/Indiana/Vevay", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Vevay>>,
  [23] #<ActiveSupport::TimeZone:0x005568a2f3e6b0 @name="America/Indiana/Vincennes", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Vincennes>>,
  [24] #<ActiveSupport::TimeZone:0x005568a2f66e30 @name="America/Indiana/Winamac", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Winamac>>,
  [25] #<ActiveSupport::TimeZone:0x005568a2e4dcd8 @name="America/Kentucky/Louisville", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Kentucky/Louisville>>,
  [26] #<ActiveSupport::TimeZone:0x005568a2e9e840 @name="America/Kentucky/Monticello", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Kentucky/Monticello>>,
  [27] #<ActiveSupport::TimeZone:0x005568a2d225c0 @name="Eastern Time (US & Canada)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/New_York>>,
  [28] #<ActiveSupport::TimeZone:0x005568a2e9e7a0 @name="Indiana (East)", @utc_offset=nil, @tzinfo=#<TZInfo::DataTimezone: America/Indiana/Indianapolis>>
]

Expected behavior

Keep behavior of public methods consistent between patch versions of release. In fact, based on code I see in our app, the Rails 5.0.2 behavior has been consistent for several major versions of Rails.

Actual behavior

The list of us_zones is larger in Rails 5.0.3

System configuration

Rails version: 5.0.3 Ruby version: 2.3.1

Note

This issue was filed as a result of discussion in separate issue starting here: https://github.com/rails/rails/issues/28431#issuecomment-303251396

BigGillyStyle avatar May 24 '17 17:05 BigGillyStyle

I can try my hand at a PR for this issue, but I would be assuming that the <5.0.3 behavior is what we'd be looking to preserve...and I don't know if that's an accurate statement.

BigGillyStyle avatar May 24 '17 21:05 BigGillyStyle

@maclover7 I see that you've added the tag "needs feedback". What feedback do you need? Or are you looking for feedback from the person assigned to this issue?

BigGillyStyle avatar Jun 02 '17 13:06 BigGillyStyle

@BigGillyStyle have you started on your PR? I have a fix just about ready to go but can work with you to make a PR.

pixeltrix avatar Jun 02 '17 15:06 pixeltrix

Hey @pixeltrix No, almost immediately after offering to work on a PR I noticed that you got assigned to this, so I thought I'd leave it to someone definitely more experienced on this than I 👍

BigGillyStyle avatar Jun 02 '17 16:06 BigGillyStyle

@pixeltrix Do you have an update on this? I'd be up for collaborating on a PR if that would be helpful.

BigGillyStyle avatar Jul 10 '17 13:07 BigGillyStyle

Looks like this bug is still present in 6.x

davidwparker avatar Jul 25 '21 15:07 davidwparker

This issue has been automatically marked as stale because it has not been commented on for at least three months. The resources of the Rails team are limited, and so we are asking for your help. If you can still reproduce this error on the 7-0-stable branch or on main, please reply with all of the information you have about it in order to keep the issue open. Thank you for all your contributions.

rails-bot[bot] avatar Aug 05 '22 06:08 rails-bot[bot]