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
Timezone offsets in time_zone_select not taking into consideration DST #21942
Comments
This is a presentational issue - the question is whether we should show the current offset in the popup menu or not. It's arguable that either is correct or even that we shouldn't show the offset at all. I think this would be best solved by moving the presentational aspect of the content to locales as we've looked at before. |
@pixeltrix Thanks for the response. I've had quite a few clients contact me worried that the incorrect offset on the timezone select would transfer over to issues on the website. Personally, I would keep the offset display on each timezone since people use them as a quick guide to find the general area where they will then start reading the timezone names. And I agree that it would be nice to have more control over the presentation of the timezones listed through locales. Any idea which way this might be going? |
@MatTarantini, maybe you should check out assert_equal '-05:00', ActiveSupport::TimeWithZone.new(Time.utc(2000, 1), @time_zone).formatted_offset
assert_equal '-04:00', ActiveSupport::TimeWithZone.new(Time.utc(2000, 6), @time_zone).formatted_offset #dst See this test. |
@MatTarantini it's relatively easy to construct your own timezone select helper method - I'm looking at moving it out to locales for Rails 5. |
@pixeltrix TimeZone.to_s(utc_total_offset: true) #=> "(GMT+02:00) Amsterdam"
TimeZone.to_s #=> "(GMT+01:00) Amsterdam" ? UPDATE: test added. |
This issue has been automatically marked as stale because it has not been commented on for at least 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 Thank you for all your contributions. |
I'm guessing that any use of This is going to be impossible to resolve on server-side so it shows the correct offset based on changing inputs. I would recommend closing this issue. Any listing of time zones is always given as the Standard offset, without DST: |
Agree with @avit - closing |
rails/activesupport/lib/active_support/values/time_zone.rb
Line 283 in 2061c15
I would recommend changing this to utc_total_offset to take Daylight Savings Time into consideration, unless this was done on purpose for a reason that I'm currently unaware of.
Example: time_zone_select shows US/Pacific as "(GMT-08:00) US/Pacific", when it should be -07:00 right now.
The text was updated successfully, but these errors were encountered: