Include time zone offset in TimeWithZone#to_json

This commit is contained in:
Daniel Morrison
2008-05-12 22:02:04 -04:00
committed by rick
parent 74fd17346f
commit f498f221bd
2 changed files with 2 additions and 2 deletions

View File

@@ -78,7 +78,7 @@ module ActiveSupport
def to_json(options = nil)
if ActiveSupport.use_standard_json_time_format
utc.xmlschema.inspect
xmlschema.inspect
else
%("#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}")
end

View File

@@ -70,7 +70,7 @@ class TimeWithZoneTest < Test::Unit::TestCase
def test_to_json_with_use_standard_json_time_format_config_set_to_true
old, ActiveSupport.use_standard_json_time_format = ActiveSupport.use_standard_json_time_format, true
assert_equal "\"2000-01-01T00:00:00Z\"", @twz.to_json
assert_equal "\"1999-12-31T19:00:00-05:00\"", @twz.to_json
ensure
ActiveSupport.use_standard_json_time_format = old
end