-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Combine code paths for duration rounding and difference
In order to prevent bugs due to discrepancies between two ways of calculating the same thing such as in #2742, refactor duration rounding with relativeTo so that duration.round({ smallestUnit, largestUnit, relativeTo, ...options }) goes through the same code path and gives the same result as const target = relativeTo.add(duration); relativeTo.until(target, { smallestUnit, largestUnit, ...options }) but taking into account that the until() methods have a different default roundingMode than Duration.prototype.round(), and optimizing away as many user-observable calls as possible. Similarly, duration.total({ unit, relativeTo, ...options }) goes through the same code path, which also returns the total as a mathematical value if needed.
- Loading branch information
Showing
6 changed files
with
564 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.