Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Jan 18, 2024
1 parent 1f28fdf commit 6b6ccb3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))
```
*/
export default function prettyMilliseconds(
milliseconds: number,
milliseconds: number | bigint,
options?: Options
): string;

21 changes: 21 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,24 @@ expectType<string>(
expectType<string>(
prettyMilliseconds(1_335_669_000, {colonNotation: true}),
);

expectType<string>(prettyMilliseconds(1_335_669_000n));
expectType<string>(prettyMilliseconds(1_335_669_000n, {secondsDecimalDigits: 1}));
expectType<string>(
prettyMilliseconds(1_335_669_000n, {millisecondsDecimalDigits: 2}),
);
expectType<string>(
prettyMilliseconds(1_335_669_000n, {keepDecimalsOnWholeSeconds: true}),
);
expectType<string>(prettyMilliseconds(1337n, {compact: true}));
expectType<string>(prettyMilliseconds(1_335_669_000n, {unitCount: 2}));
expectType<string>(prettyMilliseconds(1_335_669_000n, {verbose: true}));
expectType<string>(
prettyMilliseconds(1_335_669_000n, {separateMilliseconds: true}),
);
expectType<string>(
prettyMilliseconds(1_335_669_000n, {formatSubMilliseconds: true}),
);
expectType<string>(
prettyMilliseconds(1_335_669_000n, {colonNotation: true}),
);
5 changes: 4 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import prettyMilliseconds from 'pretty-ms';
prettyMilliseconds(1337000000);
//=> '15d 11h 23m 20s'

prettyMilliseconds(1337000000n);
//=> '15d 11h 23m 20s'

prettyMilliseconds(1337);
//=> '1.3s'

Expand Down Expand Up @@ -49,7 +52,7 @@ prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))

#### milliseconds

Type: `number`
Type: `number | bigint`

Milliseconds to humanize.

Expand Down

0 comments on commit 6b6ccb3

Please sign in to comment.