diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-29 13:11:58 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-04-29 13:12:00 -0700 |
commit | 3136b17b7f5c3acd52248c65ebbd9e2bfcf5ac19 (patch) | |
tree | b81f994441e54ab84c5c274a625b2435a30c4ca1 /activesupport | |
parent | 88265a724adda48c9cff9565da36ed733802dac7 (diff) | |
download | rails-3136b17b7f5c3acd52248c65ebbd9e2bfcf5ac19.tar.gz rails-3136b17b7f5c3acd52248c65ebbd9e2bfcf5ac19.tar.bz2 rails-3136b17b7f5c3acd52248c65ebbd9e2bfcf5ac19.zip |
AS::Duration changelog polish
Use the updated changelog from the first merge: 7254517
References #22806, #24762.
[ci skip]
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/CHANGELOG.md | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index cc27b6a0fc..3e07f5a032 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,22 +1,20 @@ -* Change `ActiveSupport::Duration` creation with numeric methods like `1.week` - to create durations with more predictable and ISO8601-conformant parts. +* `ActiveSupport::Duration` supports weeks and hours. - This is to remove astonishment from getting `3600 seconds` from `1.hour`. + [1.hour.inspect, 1.hour.value, 1.hour.parts] + # => ["3600 seconds", 3600, [[:seconds, 3600]]] # Before + # => ["1 hour", 3600, [[:hours, 1]]] # After - It should not affect current apps as duration's `value` (number of seconds) remains the same, - only hash of `parts` (and `inspect` value) is changed and only when it's constructed by calling - methods on integers. Manual construction of Durations isn't affected. - Inside the ActiveSupport::Duration itself most operations rely only on number of seconds. + [1.week.inspect, 1.week.value, 1.week.parts] + # => ["7 days", 604800, [[:days, 7]]] # Before + # => ["1 week", 604800, [[:weeks, 1]]] # After - Before: - - [1.hour.inspect, 1.hour.value, 1.hour.parts] # => ["3600 seconds", 3600, [[:seconds, 3600]]] - [1.week.inspect, 1.week.value, 1.week.parts] # => ["7 days", 604800, [[:days, 7]]] - - After: + This brings us into closer conformance with ISO8601 and relieves some + astonishment about getting `1.hour.inspect # => 3600 seconds`. - [1.hour.inspect, 1.hour.value, 1.hour.parts] # => ["1 hour", 3600, [[:hours, 1]]] - [1.week.inspect, 1.week.value, 1.week.parts] # => ["1 week", 604800, [[:weeks, 1]]] + Compatibility: The duration's `value` remains the same, so apps using + durations are oblivious to the new time periods. Apps, libraries, and + plugins that work with the internal `parts` hash will need to broaden + their time period handling to cover hours & weeks. *Andrey Novikov* |