aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time
diff options
context:
space:
mode:
authorRonak Jangir <ronakjangir47@gmail.com>2015-09-28 23:19:09 +0530
committerRonak Jangir <ronakjangir47@gmail.com>2015-09-29 07:47:58 +0530
commit25607697bcb431ff18570e9346dcaa79c53778b8 (patch)
tree21f7151f5674001f916b499b95ea9a39c78621df /activesupport/lib/active_support/core_ext/date_time
parent3c52b2000cbee716b5e449974c312c4fb552f64f (diff)
downloadrails-25607697bcb431ff18570e9346dcaa79c53778b8.tar.gz
rails-25607697bcb431ff18570e9346dcaa79c53778b8.tar.bz2
rails-25607697bcb431ff18570e9346dcaa79c53778b8.zip
Update docs for `formatted_offset`
Output of `formatted_offset` is depends on input so it’s not always in +HH:MM format. Possible outputs are “+5:30”, “+530” or provided alternate UTC string [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
index 2a9c09fc29..f59d05b214 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -40,6 +40,8 @@ class DateTime
alias_method :to_default_s, :to_s if instance_methods(false).include?(:to_s)
alias_method :to_s, :to_formatted_s
+ # Returns a formatted string of the offset from UTC, or an alternative
+ # string if the time zone is already UTC.
#
# datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24))
# datetime.formatted_offset # => "-06:00"