diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 16 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/integer/time.rb | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index fcbb3ea372..3705fc57fc 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,19 @@ +* Change Integer#year to return a Fixnum instead of a Float to improve + consistency. + + Integer#years returned a Float while the rest of the accompanying methods + (days, weeks, months, etc.) return a Fixnum. + + Before: + + 1.year # => 31557600.0 + + After: + + 1.year # => 31557600 + + *Konstantinos Rousis* + * Handle invalid UTF-8 strings when HTML escaping Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8 diff --git a/activesupport/lib/active_support/core_ext/integer/time.rb b/activesupport/lib/active_support/core_ext/integer/time.rb index f0b7382ef3..87185b024f 100644 --- a/activesupport/lib/active_support/core_ext/integer/time.rb +++ b/activesupport/lib/active_support/core_ext/integer/time.rb @@ -23,7 +23,7 @@ class Integer alias :month :months def years - ActiveSupport::Duration.new(self * 365.25.days, [[:years, self]]) + ActiveSupport::Duration.new(self * 365.25.days.to_i, [[:years, self]]) end alias :year :years end |