aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
diff options
context:
space:
mode:
authorSayan Chakraborty <mail.sayanc@gmail.com>2017-06-28 19:38:02 +0530
committerAndrew White <andrew.white@unboxed.co>2017-07-28 14:06:53 +0100
commita54e13bd2e8fb4d6aa0aebe59271699a2d62567b (patch)
treea28949c818ecdb7694faac58e3d61232fa48556f /activesupport/CHANGELOG.md
parentc6a28b290ab68455e55bcfddc7dd42edf4909ad8 (diff)
downloadrails-a54e13bd2e8fb4d6aa0aebe59271699a2d62567b.tar.gz
rails-a54e13bd2e8fb4d6aa0aebe59271699a2d62567b.tar.bz2
rails-a54e13bd2e8fb4d6aa0aebe59271699a2d62567b.zip
Add missing support for modulo operations on durations
Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as a wrapper around a numeric value as a way of ensuring a duration was the outcome of an expression. However the implementation was missing support for modulo operations. This commit adds support for those operations and should result in a duration being returned from expressions involving them. Fixes #29603 and #29743.
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r--activesupport/CHANGELOG.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 42d3467e7d..938d4f9d31 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,25 @@
+* Fix modulo operations involving durations
+
+ Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as a wrapper
+ around a numeric value as a way of ensuring a duration was the outcome of
+ an expression. However the implementation was missing support for modulo
+ operations. This support has now been added and should result in a duration
+ being returned from expressions involving modulo operations.
+
+ Prior to Rails 5.1:
+
+ 5.minutes % 2.minutes
+ => 60
+
+ Now:
+
+ 5.minutes % 2.minutes
+ => 1 minute
+
+ Fixes #29603 and #29743.
+
+ *Sayan Chakraborty*, *Andrew White*
+
* Fix division where a duration is the denominator
PR #29163 introduced a change in behavior when a duration was the denominator