This project is archived and is in readonly mode.

#175 ✓resolved
Daniel Morrison

TimeWithZone#to_json should include time zone

Reported by Daniel Morrison | May 13th, 2008 @ 03:05 AM

This patch includes the time zone information in the json representation for two reasons: consistency and usefulness.

Consistency: DateTime includes the zone, whereas Time does not:

>> Time.zone.now.to_json
=> "\"2008-05-13T01:47:35Z\""
>> Time.zone.now.to_datetime.to_json
=> "\"2008-05-12T18:47:42-07:00\""

Usefulness: Without including the zone offset, there is no way to figure out what zone the time was intended to be in. You can always figure out UTC (and any other offset) but determining the original is impossible.

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>

People watching this ticket

Attachments

Pages