mirror of https://github.com/rails/rails
document String#to_time exception
This commit is contained in:
parent
2cf86936b7
commit
796ed59e20
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue