Skip to content

Commit

Permalink
Update description of includeAffix arg
Browse files Browse the repository at this point in the history
  • Loading branch information
opr committed Jun 8, 2022
1 parent 0c749c9 commit 73167e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/date/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ _Parameters_

- _from_ `Moment | Date | string | undefined`: The timestamp to measure from. Defaults to the current time if undefined or invalid.
- _to_ `Moment | Date | string | undefined`: The timestamp to measure to. Defaults to the current time if undefined or invalid.
- _includeAffix_ `boolean`: Whether to include the "ago" suffix in the comparison.
- _includeAffix_ `boolean`: Whether to include the "ago" or "to" affix in the comparison.

_Returns_

Expand Down
3 changes: 2 additions & 1 deletion packages/date/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,11 @@ export function getDate( dateString ) {
*
* @param {Moment | Date | string | undefined} from The timestamp to measure from. Defaults to the current time if undefined or invalid.
* @param {Moment | Date | string | undefined} to The timestamp to measure to. Defaults to the current time if undefined or invalid.
* @param {boolean} includeAffix Whether to include the "ago" suffix in the comparison.
* @param {boolean} includeAffix Whether to include the "ago" or "to" affix in the comparison.
* @return {string} The difference between the timestamps.
*/
export function humanTimeDiff( from, to, includeAffix ) {
// Normalize inputs to a moment object, defaults to current time.
from = momentLib( from );
to = momentLib( to );
return from.from( to, ! includeAffix );
Expand Down

0 comments on commit 73167e6

Please sign in to comment.