This project is archived and is in readonly mode.

#3658 ✓ resolved
Jens

Dirty datetime attributes lose time zone info

Reported by Jens | January 5th, 2010 @ 03:15 PM | in 2.3.6

When modifying a datetime attribute of an ActiveRecord object, its history is saved but without time zone information. Example:

>> q.start_at
=> Tue, 24 Nov 2009 11:21:08 CET +01:00
>> q.start_at_was
=> Tue, 24 Nov 2009 11:21:08 CET +01:00
>> q.start_at = Time.zone.now
=> Tue, 05 Jan 2010 16:09:52 CET +01:00
>> q.start_at
=> Tue, 05 Jan 2010 16:09:52 CET +01:00
>> q.start_at_was
=> Tue Nov 24 10:21:08 UTC 2009

I would expect q.start_at_was to return the old CET value, also after the change.

q is an instance of a normal ActiveRecord object, start_at is a datetime column (served from a PostgreSQL 8.3 server with all timezones turned off). Using Rails 2.3.4, Ruby 1.8.6, on Mac OS X.

Comments and changes to this ticket

Create your profile

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

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Referenced by

Pages