Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix confusion about Temporal.Time.difference largest unit #593

Merged
merged 1 commit into from
May 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/time.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ time.minus({ minutes: 5, nanoseconds: 800 }) // => 19:34:09.068345405
The following options are recognized:
- `largestUnit` (string): The largest unit of time to allow in the resulting `Temporal.Duration` object.
Valid values are `'years'`, `'months'`, `'days'`, `'hours'`, `'minutes'`, and `'seconds'`.
The default is `days`.
The default is effectively `'hours'`.

**Returns:** a `Temporal.Duration` representing the difference between `time` and `other`.

Expand All @@ -258,8 +258,8 @@ The returned `Temporal.Duration` object will not have any nonzero fields that ar
A difference of two hours will become 7200 seconds when `largestUnit` is `"seconds"`, for example.
However, a difference of 30 seconds will still be 30 seconds even if `largestUnit` is `"hours"`.

The default largest unit in the result is hours.
Since this method never returns any duration longer than 12 hours, largest units of years, months, or days, are by definition ignored and treated as hours.
The default largest unit in the result is technically days, for consistency with other Temporal types' `difference` methods.
However, since this method never returns any duration longer than 12 hours, largest units of years, months, or days, are by definition treated as hours.

Usage example:
```javascript
Expand Down