aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/json/encoders/time.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-07-17 11:52:56 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-07-17 11:52:56 -0700
commit636e6b7138864ceb1e309939cd879e710b287f3e (patch)
tree2a36dfef02f706302a20bb5b2d428b32e9af97f0 /activesupport/lib/active_support/json/encoders/time.rb
parent842917dea0cfdf70f158a312cc1f77f769791d8c (diff)
parent99930d499e424f4560b371412e05d10476216ece (diff)
downloadrails-636e6b7138864ceb1e309939cd879e710b287f3e.tar.gz
rails-636e6b7138864ceb1e309939cd879e710b287f3e.tar.bz2
rails-636e6b7138864ceb1e309939cd879e710b287f3e.zip
Merge branch 'master' into i18n-merge
Conflicts: actionpack/lib/action_view/helpers/form_options_helper.rb activerecord/lib/active_record/validations.rb
Diffstat (limited to 'activesupport/lib/active_support/json/encoders/time.rb')
-rw-r--r--activesupport/lib/active_support/json/encoders/time.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/json/encoders/time.rb b/activesupport/lib/active_support/json/encoders/time.rb
index 57ed3c9e31..09fc614889 100644
--- a/activesupport/lib/active_support/json/encoders/time.rb
+++ b/activesupport/lib/active_support/json/encoders/time.rb
@@ -1,9 +1,16 @@
class Time
- # Returns a JSON string representing the time.
+ # Returns a JSON string representing the time. If ActiveSupport.use_standard_json_time_format is set to true, the
+ # ISO 8601 format is used.
#
- # ==== Example:
+ # ==== Examples:
+ #
+ # # With ActiveSupport.use_standard_json_time_format = true
+ # Time.utc(2005,2,1,15,15,10).to_json
+ # # => "2005-02-01T15:15:10Z"
+ #
+ # # With ActiveSupport.use_standard_json_time_format = false
# Time.utc(2005,2,1,15,15,10).to_json
- # # => 2005/02/01 15:15:10 +0000"
+ # # => "2005/02/01 15:15:10 +0000"
def to_json(options = nil)
if ActiveSupport.use_standard_json_time_format
xmlschema.inspect