Hey Geoff, Liam,

I'm running into the same issue, and it's very simple to create an
example.

1) $> rails time_select_problem
2) $> cd time_select_problem
3) $> ruby script/generate scaffold stores name:string opens:time
4) Edit config/environment.rb, set config.time_zone = 'Eastern Time
(US & Canada)' and config.active_record.default_timezone = :utc
5) $> rake db:create db:migrate
6) $> ruby script/server
7) Navigate to localhost:3000/stores/new
8) Create one, setting the time to 10:00 AM
9) After creation, go to show/edit.  You'll see that the time is
displayed in both as 3:00 PM.  I can understand 'show' failing, as we
haven't directly converted to this user's timezone.  But edit _should_
show up correctly.  If you check the database, you'll see that it was
stored as 3:00 PM UTC.  The conversion is made from EST to UTC.  But
when we pull it back out using either time_select or datetime_select,
the conversion back is not made.

Does this better illustrate the problem?  Is there a flaw in my
process?  Am I missing something here?  It just doesn't seem right
that I select 10:00 in the time slot, and then when I edit it with the
same form, it shows something else!

-John

On Sep 7, 5:21 pm, Geoff B <[EMAIL PROTECTED]> wrote:
> HI Liam,
>
> I'd need a bit more info (rails version, config.time_zone setting,
> store opening time column type, and exactly what you're doing when you
> "refresh the form") to determine whether this is a framework issue or
> an application design issue.
>
> Feel free to contact me directly if you like.
>
> Geoff
>
> On Sep 7, 12:30 am, Liam Morley <[EMAIL PROTECTED]> wrote:
>
> > I'm running into an issue where I'd like to use timezones in my
> > application, but I'd also like to use times in places where timezone
> > is not applicable. For example, I have a Store model, and I need to
> > track what time of day the store opens. I'm using time_select to edit
> > this field in my form, and when I submit the form with 0 hours, it
> > goes in the db as 05:00:00 (I'm in EST). Then when I refresh the form,
> > it reads this as 05:00:00, and so the displayed number for hours is
> > always 5 more than I entered. Seems to me that the translation to/from
> > utc is only occurring in one direction.
>
> > I'm posting this here on the advice of bitsweat from irc. If anybody
> > wants more information or a pastie of sorts, let me know.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to