TimeZone Select Problemin Rails 3?

I am running Rails 3.0.3. I am using the below line of code to
generate a list of possible time zones.

<%= form.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones
%>

However, the options at least for the US are off by one hour. It for
example lists the Eastern Time zone as +5 relative to GMT however it
should be +4. http://www.worldtimeserver.com/current_time_in_US-MI.aspx

When I go to the console, it recognizes that given that I am in the
eastern time zone, it is +4.

irb(main):046:0> Time.now
=> Tue Apr 12 21:52:48 -0400 2011
irb(main):047:0> Time.now.utc
=> Wed Apr 13 01:52:55 UTC 2011

I do not recall running into such an issue on Rails 2.x on this app.
However, it was never in production so perhaps it existed there also?

On 13 Apr 2011, at 02:55, “tashfeen.ekram” [email protected]
wrote:

I am running Rails 3.0.3. I am using the below line of code to
generate a list of possible time zones.

<%= form.time_zone_select :time_zone, ActiveSupport::TimeZone.us_zones
%>

However, the options at least for the US are off by one hour. It for
example lists the Eastern Time zone as +5 relative to GMT however it
should be +4.

Is this because at the moment daylight savings time is in effect?

Fred

On Wed, Apr 13, 2011 at 2:21 AM, Frederick C. <
[email protected]> wrote:

However, the options at least for the US are off by one hour. It for
example lists the Eastern Time zone as +5 relative to GMT however it
should be +4.

Is this because at the moment daylight savings time is in effect?

Fred

I would think so. Given that East Coast is -5 GMT always and is just
adjusted forward if DST is honored. There are some places in the US
where it
is not honored.

B.

OK. So, it will always display times on the select menu according to
standard time? I just thought since we are in day light savings time
which would make the Eastern time zone is GMT -4, it should say GMT -4
rather than GMT -5 which is what it is in standard time. Basically, it
does not actually adjust?

As it seems like TimeZone has been depreciated (http://apidock.com/
rails/TimeZone). what is the time zone library that should be used?

Should we be using TZinfo?

On Apr 15, 12:44pm, “tashfeen.ekram” [email protected]

I take that back. It does not seem like it is depreciated as it is in
the latest rails docs…

On Apr 19, 11:05am, “tashfeen.ekram” [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs