aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2017-07-05 10:57:07 -0700
committerGitHub <noreply@github.com>2017-07-05 10:57:07 -0700
commit81492d8f914b39cba4ddb0569af28ebbbed73fa6 (patch)
tree78d2f15281aafecd981f4fcc20e5926cbc8e5080 /activesupport/lib
parent2ae84d2fa09af85166f35ca44238a6a20d3c1554 (diff)
parenta5ce433f11af8991451f71b53e6f6899d4d5d288 (diff)
downloadrails-81492d8f914b39cba4ddb0569af28ebbbed73fa6.tar.gz
rails-81492d8f914b39cba4ddb0569af28ebbbed73fa6.tar.bz2
rails-81492d8f914b39cba4ddb0569af28ebbbed73fa6.zip
Merge pull request #28668 from Dorian/mention-time-parse-argument-error
Mention Time.zone.parse possibly throwing ArgumentError
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 0659b39981..890a2af51c 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -359,7 +359,7 @@ module ActiveSupport
# Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00
#
# If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
- # which returns +nil+ when given an invalid date string.
+ # which usually returns +nil+ when given an invalid date string.
def iso8601(str)
parts = Date._iso8601(str)
@@ -398,6 +398,8 @@ module ActiveSupport
# components are supplied, then the day of the month defaults to 1:
#
# Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00
+ #
+ # If the string is invalid then an +ArgumentError+ could be raised.
def parse(str, now = now())
parts_to_time(Date._parse(str, false), now)
end