public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fix JSON decoder date-converter regexp [#1662 state:resolved] [Jonathan del 
Strother]
lifo (author)
Wed Jan 07 09:51:11 -0800 2009
commit  17da45b789e0a2581eae6e6b2b1ae8d2b98e0f5d
tree    7c98524e11bf17bcf29a838c0ad9db2d972bf3ee
parent  2f923133248eb3a11671f47695bb9c5f36ee6aef
...
16
17
18
19
 
20
21
22
...
16
17
18
 
19
20
21
22
0
@@ -16,7 +16,7 @@ module ActiveSupport
0
       
0
       protected
0
         # matches YAML-formatted dates
0
-        DATE_REGEX = /^\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/
0
+        DATE_REGEX = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?)$/
0
 
0
         # Ensure that ":" and "," are always followed by a space
0
         def convert_json_to_yaml(json) #:nodoc:
...
15
16
17
18
 
 
19
20
21
...
15
16
17
 
18
19
20
21
22
0
@@ -15,7 +15,8 @@ class TestJSONDecoding < Test::Unit::TestCase
0
     # no time zone
0
     %({a: "2007-01-01 01:12:34"})              => {'a' => "2007-01-01 01:12:34"}, 
0
     # needs to be *exact*
0
-    %({a: " 2007-01-01 01:12:34 Z "})          => {'a' => " 2007-01-01 01:12:34 Z "}, 
0
+    %({a: " 2007-01-01 01:12:34 Z "})          => {'a' => " 2007-01-01 01:12:34 Z "},
0
+    %({a: "2007-01-01 : it's your birthday"})  => {'a' => "2007-01-01 : it's your birthday"},
0
     %([])    => [],
0
     %({})    => {},
0
     %(1)     => 1,

Comments