diff options
author | Eugene Kenny <elkenny@gmail.com> | 2018-06-25 13:48:35 +0100 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2018-06-25 13:48:35 +0100 |
commit | 376b687cb70d7cd8d84bd5f7c2acc45153359985 (patch) | |
tree | 549a6fc8005720cff0dec6308fa4c0462d919acf /guides/source/_license.html.erb | |
parent | b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c (diff) | |
download | rails-376b687cb70d7cd8d84bd5f7c2acc45153359985.tar.gz rails-376b687cb70d7cd8d84bd5f7c2acc45153359985.tar.bz2 rails-376b687cb70d7cd8d84bd5f7c2acc45153359985.zip |
Add tests for duration multiplication and division
When multiplying or dividing a duration by a scalar, it's tempting to
operate directly on the duration's value in seconds and recompute the
parts from the result. However this loses information, as there are
multiple combinations of parts that map to any given number of seconds
(e.g. `2.weeks` or `336.hours`). This is especially problematic when
dealing with durations on the scale of months or years, as converting an
exact number of seconds to one of those intervals and then using the
resulting duration to modify a date will give the wrong result.
Diffstat (limited to 'guides/source/_license.html.erb')
0 files changed, 0 insertions, 0 deletions