diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-11 17:08:31 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-05-11 17:08:31 -0500 |
commit | 53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062 (patch) | |
tree | 0298168ad45f958bb88e9488a6338eec4d71e435 /activesupport | |
parent | 7bf6edf819adf48b253dce7673ec82cda821646b (diff) | |
download | rails-53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062.tar.gz rails-53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062.tar.bz2 rails-53cc85fad3440d5817ecf7e0e8cd0c7ff3d9a062.zip |
added docs to String#to_date
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/string/conversions.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb index 9084bbee32..c42163a2f0 100644 --- a/activesupport/lib/active_support/core_ext/string/conversions.rb +++ b/activesupport/lib/active_support/core_ext/string/conversions.rb @@ -15,6 +15,12 @@ class String end end + # Converts a string to a Date value. + # + # "1-1-2012".to_date #=> Sun, 01 Jan 2012 + # "01/01/2012".to_date #=> Sun, 01 Jan 2012 + # "2012-12-13".to_date #=> Thu, 13 Dec 2012 + # "12/13/2012".to_date #=> ArgumentError: invalid date def to_date unless blank? date_values = ::Date._parse(self, false).values_at(:year, :mon, :mday) |