sferik/rails_admin — pull request #894 by jmondo (2011-12-25 00:40:30+00:00)
Title: UTC parsing for Time fields

As it currently operates, rails admin parses time fields (time, timestamp, datetime, date) before submitting as part of the normalize method defined in the Datetime field type. This works for timestamp, datetime, and date, but not for time, since ActiveRecord reads and writes time columns in UTC.

For apps with a time zone configured, rails_admin currently displays times in UTC (the rails default), the user enters a time in UTC, rails admin parses this using the app's time zone, then it is saved it to the database, where rails converts to UTC, offsetting the time by the time zone's offset from UTC.

ie.. for an app in eastern time: I create an object and set the time to '13:37' in the time field, i click 'save and edit' then it says '18:37', click again, it says '23:37', and so on.

I added a test to verify this. Without the fix it fails, and with the fix it passes. I also gave a brief description of the separate normalize and parse_date_string methods for documentation purposes.

This is my first contribution to open source projects, so let me know if you need any additional information or help.

Merry Christmas!