This project is archived and is in readonly mode.

#4659 ✓invalid
Matthijs Langenberg

ActiveRecord does not convert time attributes to proper timezone

Reported by Matthijs Langenberg | May 20th, 2010 @ 12:29 PM

Problem found in Rails3-beta3

ActiveRecord does convert the time attribute to UTC on saving to the database, but does not convert it back to the right timezone.

# config.time_zone = 'Amsterdam' (in application.rb)
ruby-1.8.7-p249 > e = Event.create(:event_time => Time.zone.parse("10:50")) # 'event_time' is a time-field
puts e.event_time 
#=> Thu May 20 10:50:00 +0200 2010
e.reload
puts e.event_time
#=> Sat Jan 01 08:50:00 UTC 2000 <-- ActiveRecord should convert this automatically right?

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 »

<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>

Pages