aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-07-28 16:34:43 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-07-28 16:34:43 -0500
commitb67a80de9b55f91feb1c1056824f456710a96d0d (patch)
treee672e374bc2aea9fa3c00b8e4b3e810fcab8c8c7 /activesupport/lib/active_support/core_ext
parent586173204c4cff94c479518e3e9b58ef4790a764 (diff)
downloadrails-b67a80de9b55f91feb1c1056824f456710a96d0d.tar.gz
rails-b67a80de9b55f91feb1c1056824f456710a96d0d.tar.bz2
rails-b67a80de9b55f91feb1c1056824f456710a96d0d.zip
Add Time#to_s(:iso8601) for easy conversion of times to the iso8601 format for easy Javascript date parsing
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/time/conversions.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb
index 48654eb1cc..a87455dedb 100644
--- a/activesupport/lib/active_support/core_ext/time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/time/conversions.rb
@@ -16,7 +16,8 @@ class Time
:rfc822 => lambda { |time|
offset_format = time.formatted_offset(false)
time.strftime("%a, %d %b %Y %H:%M:%S #{offset_format}")
- }
+ },
+ :iso8601 => "%Y-%m-%dT%H:%M:%SZ"
}
# Converts to a formatted string. See DATE_FORMATS for builtin formats.