diff options
author | Andrew White <andrew.white@unboxed.co> | 2017-03-03 20:14:22 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2017-03-03 21:53:13 +0000 |
commit | f0aeecda1450ba17701ccba68e5a796ce4ac4c3b (patch) | |
tree | 5577db6b1f3424711bf3b35493ba55cf95ae86b7 /activesupport/lib/active_support | |
parent | 08e05d4a49c1ba1327e3e6821eba1f0c93361ab2 (diff) | |
download | rails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.tar.gz rails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.tar.bz2 rails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.zip |
Add `rfc3339` aliases to `xmlschema`
For naming consistency when using the RFC 3339 profile
of ISO 8601 in applications.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/conversions.rb | 3 | ||||
-rw-r--r-- | activesupport/lib/active_support/time_with_zone.rb | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb index f2bbe55aa6..595bda6b4f 100644 --- a/activesupport/lib/active_support/core_ext/time/conversions.rb +++ b/activesupport/lib/active_support/core_ext/time/conversions.rb @@ -64,4 +64,7 @@ class Time def formatted_offset(colon = true, alternate_utc_string = nil) utc? && alternate_utc_string || ActiveSupport::TimeZone.seconds_to_utc_offset(utc_offset, colon) end + + # Aliased to +xmlschema+ for compatibility with +DateTime+ + alias_method :rfc3339, :xmlschema end diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 857cc1a664..e31983cf26 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -148,6 +148,7 @@ module ActiveSupport "#{time.strftime(PRECISIONS[fraction_digits.to_i])}#{formatted_offset(true, 'Z'.freeze)}" end alias_method :iso8601, :xmlschema + alias_method :rfc3339, :xmlschema # Coerces time to a string for JSON encoding. The default format is ISO 8601. # You can get %Y/%m/%d %H:%M:%S +offset style by setting |