This project is archived and is in readonly mode.
[PATCH] AS::JSON#decode does not parse xmlschema date strings to Time objects.
Reported by Bas van Klinkenberg | August 10th, 2009 @ 06:41 PM
ActiveSupport::JSON.decode automatically parses datestrings in json to Time objects, but fails to do so with xmlschema datetime notation (e.g. "2009-08-10T19:34:24+02:00"). Instead it returns a string rather than a Time object.
This used to work in rails 2.1.2, before the json gem/yaml backend split.
I've added 3 test cases (utc, positive and negative time zone) and a very simple fix in the date regexp (which adds the eventual T between date and time in the regexp).
Comments and changes to this ticket
-
Elad Meidar August 10th, 2009 @ 10:19 PM
+1 verified, tests fail on 2-3-stable. -1 on patch, errors while attempting to apply.
attached a working patch with passing tests for 2-3-stable
-
Elad Meidar August 10th, 2009 @ 10:22 PM
It crossed my mind that the first patch was not meant to apply on 2-3-stable, and it does apply on master cleanly with tests.
-
Bas van Klinkenberg August 11th, 2009 @ 09:01 AM
Thanks for verifying. The patch is based on master indeed (i'm following the contributor's guide).
-
Wolfram Arnold August 24th, 2010 @ 10:38 PM
- Importance changed from to
Thanks that matches my experience. The DATE_REGEX needs updating.
-
Wolfram Arnold January 13th, 2011 @ 09:46 PM
- Assigned user set to Sven Fuchs
-
Repository February 12th, 2011 @ 03:32 PM
- State changed from new to resolved
(from [e8c870726a67a27965b2a5333a5ecf450d4f458f]) Updated the json date regex to recognize xmlschema formatted date times during json decoding. [#3031 state:resolved]
Signed-off-by: Santiago Pastorino and Emilio Tagua santiago+emilioe@wyeworks.com
https://github.com/rails/rails/commit/e8c870726a67a27965b2a5333a5ec... -
Repository February 12th, 2011 @ 03:35 PM
(from [73b9e43f5d3c9a9a0e5ff2048a5be52352e62eab]) Updated the json date regex to recognize xmlschema formatted date times during json decoding. [#3031 state:resolved]
Signed-off-by: Santiago Pastorino and Emilio Tagua santiago+emilioe@wyeworks.com
https://github.com/rails/rails/commit/73b9e43f5d3c9a9a0e5ff2048a5be...
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
Tags
Referenced by
- 3031 [PATCH] AS::JSON#decode does not parse xmlschema date strings to Time objects. (from [e8c870726a67a27965b2a5333a5ecf450d4f458f]) Updated...
- 3031 [PATCH] AS::JSON#decode does not parse xmlschema date strings to Time objects. (from [73b9e43f5d3c9a9a0e5ff2048a5be52352e62eab]) Updated...