This project is archived and is in readonly mode.

#1380 ✓wontfix
David Parker

text_field tag has incorrect time

Reported by David Parker | November 15th, 2008 @ 06:58 PM | in 2.x

I'm working on an app where I have my time_zone set to something not UTC: config.time_zone = 'Central Time (US & Canada)'

When I go to edit a model in my app for that time zone, text_field returns the incorrect time. The datetime_select tag returns the correct time though.

So pretty much, this works and returns the time based on the offset:

= f.datetime_select :posted_at

and this one doesn't:

= f.text_field :posted_at

Thanks and keep up the good work!

Comments and changes to this ticket

  • Geoff Buesing

    Geoff Buesing December 2nd, 2008 @ 01:05 AM

    • State changed from “new” to “wontfix”

    Hmm, I agree that's not what you'd expect to see, but it would be pretty hard to fix this, given that text_field is built with the _before_type_cast version of the attribute.

    But even if we could fix this, I'm skeptical that the default presentation would be valuable -- the user would see a value like this:

    
    2008-11-20 17:35:09 -0600
    

    ... a db-like output, with an offset string -- I think you'd want friendlier formatting for the user.

    You can currently achieve this via text_field_tag -- something like:

    
    text_field_tag "post[publish_at]", @post.publish_at.to_s(:my_friendly_format)
    
  • David Parker

    David Parker December 2nd, 2008 @ 01:15 AM

    Thanks for checking this out Geoff.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages