Permalink
Browse files

document String#to_time exception

  • Loading branch information...
1 parent 2cf8693 commit 796ed59e20dc739f1c3b195692a60d8e5d97c166 @vipulnsward vipulnsward committed May 2, 2013
Showing with 1 addition and 0 deletions.
  1. +1 −0 activesupport/lib/active_support/core_ext/string/conversions.rb
@@ -15,6 +15,7 @@ class String
# "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 05:12:00 UTC
+ # "12/13/2012".to_time # => ArgumentError: argument out of range
def to_time(form = :local)
parts = Date._parse(self, false)
return if parts.empty?

0 comments on commit 796ed59

Please sign in to comment.