aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorNikolay Kondratyev <nkondratyev@yandex.ru>2015-02-08 19:18:30 +0500
committerNikolay Kondratyev <nkondratyev@yandex.ru>2015-06-01 13:25:09 +0500
commitd98928019a1ecc0c0ceacb46a220bf465057f033 (patch)
tree9dba6f979cab7c6d414c2551ad0b46a8b4050e8e /activesupport/lib/active_support
parentc4cb751da695aa9d2cbe45adcf53afc3d268e4fa (diff)
downloadrails-d98928019a1ecc0c0ceacb46a220bf465057f033.tar.gz
rails-d98928019a1ecc0c0ceacb46a220bf465057f033.tar.bz2
rails-d98928019a1ecc0c0ceacb46a220bf465057f033.zip
Fix a range of values for parameters of the Time#change
Passing 999999000 < `:nsec` < 999999999 and 999999 < `:usec` < 1000000 to change a time with utc_offset doesn't throw an `ArgumentError`.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 1ce68ea7c7..c554501893 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -98,7 +98,7 @@ class Time
elsif zone
::Time.local(new_year, new_month, new_day, new_hour, new_min, new_sec, new_usec)
else
- raise ArgumentError, 'argument out of range' if new_usec > 999999
+ raise ArgumentError, 'argument out of range' if new_usec >= 1000000
::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec + (new_usec.to_r / 1000000), utc_offset)
end
end