aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2015-05-21 08:55:09 +0200
committerYves Senn <yves.senn@gmail.com>2015-05-21 08:55:09 +0200
commitb052a4626811080634443f0d6a5e9c2cab883049 (patch)
tree996536cb066b9dcdddc206aa3230a600d271e133
parentf271f43f1059982e4e43c29ba2f8abc974ba0ea8 (diff)
parent30f831804776df7d659f868baf0d257ad58fbffa (diff)
downloadrails-b052a4626811080634443f0d6a5e9c2cab883049.tar.gz
rails-b052a4626811080634443f0d6a5e9c2cab883049.tar.bz2
rails-b052a4626811080634443f0d6a5e9c2cab883049.zip
Merge pull request #20235 from davydovanton/doc-update-date
[skip ci] Update documentation for Date class
-rw-r--r--activesupport/lib/active_support/core_ext/date/conversions.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb
index df419a6e63..31479a1269 100644
--- a/activesupport/lib/active_support/core_ext/date/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -35,6 +35,7 @@ class Date
# date.to_s(:db) # => "2007-11-10"
#
# date.to_formatted_s(:short) # => "10 Nov"
+ # date.to_formatted_s(:number) # => "20071110"
# date.to_formatted_s(:long) # => "November 10, 2007"
# date.to_formatted_s(:long_ordinal) # => "November 10th, 2007"
# date.to_formatted_s(:rfc822) # => "10 Nov 2007"
@@ -82,6 +83,11 @@ class Date
::Time.send(form, year, month, day)
end
+ # Returns a string which represents the time in used time zone as DateTime
+ # defined by XML Schema:
+ #
+ # date = Date.new(2015, 05, 23) # => Sat, 23 May 2015
+ # date.xmlschema # => "2015-05-23T00:00:00+04:00"
def xmlschema
in_time_zone.xmlschema
end