Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

TimeWithZones aren't serialized properly in Hash#to_xml

#2223

Attempting to convert a hash containing TimeWithZone objects to xml :


{:time => Time.now.in_time_zone}.to_xml

will give datetimes that don't match iso8601

This patch adds ActiveSupport::TimeWithZone to the list of XML_TYPE_NAMES, so that TimeWithZone#xmlschema is used when serializing them.

Reported by Jonathan del Strother · March 12th, 2009 @ 06:08 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Pratik
    Pratik
    • Tag set to patch
    • Title changed from [PATCH] TimeWithZones aren't serialized properly in Hash#to_xml to TimeWithZones aren't serialized properly in Hash#to_xml

    March 12th, 2009 @ 06:18 PM

  2. Repository
    Repository
    • State changed from new to resolved

    (from [923067810480c93817dbae3d8295a18aa2a2ec3a]) Use xmlschema when serializing TimeWithZones to xml [#2223 TimeWithZones aren't serialized properly in Hash#to_xml state:resolved]

    When using Hash#to_xml, any TimeWithZone objects now use xmlschema (iso8601), rather than a simple TimeWithZone#to_s.

    Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...

    March 12th, 2009 @ 06:37 PM