This project is archived and is in readonly mode.
ActiveRecord's to_json method ignores timezone when serializing Time objects
Reported by rathboma | June 24th, 2010 @ 04:45 PM
Simple example to demonstrate (tested in Rails 2.3.5):
now = Time.parse("Thu Jun 24 15:41:23 UTC 2010")
now2 = Time.parse(now.to_json)
check these results out:
puts now => Thu Jun 24 15:41:23 UTC 2010
puts now2 => Thu Jun 24 11:41:23 -0400 2010
They're different!
This is because:
now.to_json => ""2010/06/24 15:41:23 +0000"" as you can see, the
timezone is incorrectly specified
Comments and changes to this ticket
-
Santiago Pastorino June 26th, 2010 @ 10:29 PM
- State changed from new to invalid
- Importance changed from to Low
This is working ok on both 2-3-stable and master branches.
Please try again on with the latest git code and if you still get the error i will reopen the issue.
Thank you
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>