diff options
author | Dorian MariƩ <dorian@doma.io> | 2017-04-04 14:37:02 -0700 |
---|---|---|
committer | Dorian MariƩ <dorian@doma.io> | 2017-04-08 16:16:27 -0700 |
commit | a5ce433f11af8991451f71b53e6f6899d4d5d288 (patch) | |
tree | 09fb57b3b9fd97fa1637e907befa286e932ceb12 /activesupport/lib/active_support/values | |
parent | c866cf9df8b7d767f8be8272b120b44f453212cb (diff) | |
download | rails-a5ce433f11af8991451f71b53e6f6899d4d5d288.tar.gz rails-a5ce433f11af8991451f71b53e6f6899d4d5d288.tar.bz2 rails-a5ce433f11af8991451f71b53e6f6899d4d5d288.zip |
Mention and test for possible ArgumentError when parsing times
Diffstat (limited to 'activesupport/lib/active_support/values')
-rw-r--r-- | activesupport/lib/active_support/values/time_zone.rb | 4 |
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 ce5207546d..dd69383f5f 100644 --- a/activesupport/lib/active_support/values/time_zone.rb +++ b/activesupport/lib/active_support/values/time_zone.rb @@ -358,7 +358,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) @@ -397,6 +397,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 |