Ticket #8399: patch_for_date_time_json.diff
| File patch_for_date_time_json.diff, 1.4 kB (added by wycats, 1 year ago) |
|---|
-
test/json/encoding_test.rb
old new 29 29 [ ActiveSupport::JSON::Variable.new('alert("foo")'), 'alert("foo")']] 30 30 RegexpTests = [[ /^a/, '/^a/' ], [/^\w{1,2}[a-z]+/ix, '/^\\w{1,2}[a-z]+/ix']] 31 31 32 DateTests = [[ Date.new(2005,1,1), "\"01/01/2005\"" ]] 33 34 TimeTests = [[ Time.at(0), "\"12/31/1969 16:00:00 #{ Time.at(0).zone }\"" ]] 35 32 36 constants.grep(/Tests$/).each do |class_tests| 33 37 define_method("test_#{class_tests[0..-6].downcase}") do 34 38 self.class.const_get(class_tests).each do |pair| -
lib/active_support/json/encoders/date.rb
old new 1 class Date 2 def to_json #:nodoc: 3 "\"#{ strftime("%m/%d/%Y") }\"" 4 end 5 end -
lib/active_support/json/encoders/time.rb
old new 1 class Time 2 def to_json #:nodoc: 3 "\"#{ strftime("%m/%d/%Y %H:%M:%S %Z") }\"" 4 end 5 end