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.

[PATCH] AS::JSON#decode does not parse xmlschema date strings to Time objects.

#3031

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

Reported by Bas van Klinkenberg · August 10th, 2009 @ 06:41 PM

State: resolved
Milestone: none
Assigned to: Sven Fuchs Sven Fuchs
Importance: none

Activity

  1. Elad Meidar
    Elad Meidar

    +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

    August 10th, 2009 @ 10:19 PM

  2. Elad Meidar
    Elad Meidar

    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.

    August 10th, 2009 @ 10:22 PM

  3. Bas van Klinkenberg
    Bas van Klinkenberg

    Thanks for verifying. The patch is based on master indeed (i'm following the contributor's guide).

    August 11th, 2009 @ 09:01 AM

  4. Wolfram Arnold
    Wolfram Arnold
    • Importance changed from to

    Thanks that matches my experience. The DATE_REGEX needs updating.

    August 24th, 2010 @ 10:38 PM

  5. Wolfram Arnold
    Wolfram Arnold
    • Assigned user set to Sven Fuchs

    January 13th, 2011 @ 09:46 PM

  6. Repository
    Repository
    • State changed from new to resolved

    (from [e8c870726a67a27965b2a5333a5ecf450d4f458f]) Updated the json date regex to recognize xmlschema formatted date times during json decoding. [#3031 [PATCH] AS::JSON#decode does not parse xmlschema date strings to Time objects. state:resolved]

    Signed-off-by: Santiago Pastorino and Emilio Tagua santiago+emilioe@wyeworks.com
    https://github.com/rails/rails/commit/e8c870726a67a27965b2a5333a5ec...

    February 12th, 2011 @ 03:32 PM

  7. Repository